The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

ulimit for cpu annd memory

Discussion in 'Workarounds and Optimization' started by vmicovic, Jun 3, 2015.

  1. vmicovic

    vmicovic Well-Known Member

    Joined:
    Sep 4, 2007
    Messages:
    95
    Likes Received:
    0
    Trophy Points:
    6
    Hi,

    i wondering is there possibility to limit user resources (cpu and ram) with ulimit?
    in /etc/profile to add limit like this:
    Code:
    LIMITUSER=$USER
    if [ -e "/usr/bin/whoami" ]; then
            LIMITUSER=`/usr/bin/whoami`
    fi
    if [ "$LIMITUSER" != "USERNAME" ]; then
            ulimit -n 10 -u 5 -m 200000 -d 200000 -s 8192 -c 200000 -v unlimited 2>/dev/null
    else
            ulimit -n 4096 -u 14335 -m unlimited -d unlimited -s 8192 -c 1000000 -v unlimited 
    2>/dev/null
    fi
    
    so, this USERNAME cannot start more then 5 process ?



    tnx.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page