I am running centos, cpanel/whm, and I have cpulimit installed.
The problem I am having is one of my users is using an extreme amount of cpu usage. Over 100% consistently and it's slowing down my server.
Further problem is they are a friend and not malicious so I don't want to suspend them.
Also what further is an issue is that I can't limit it by process, because this process changes every second. It's a different process every time.
I tried the following but it doesn't work.
cpulimit -l 10 -e /home/[username]/public_html/theirwebsite.org/index.php
I just get returned,
No process found
No process found
No process found
No process found
No process found
No process found
etc
There are two things that are using that extreme cpu usage.
First thing is that file at that location, index.php
.
Other is [php], whatever that means in WHM. But mainly the index.php
is the problem.
If I could limit that index.php
file in that location, that might help mitigate this issue.
By the way, I tried the -P
flag but that isn't available as an option unlike the documentation.
cpulimit -l 10 -P /home/[username]/public_html/theirwebsite.org/index.php
returns
cpulimit: invalid option -- 'P'
Usage: cpulimit [OPTIONS...] TARGET
OPTIONS
-l, --limit=N percentage of cpu allowed from 0 to 1600 (required)
-v, --verbose show control statistics
-z, --lazy exit if there is no target process, or if it dies
-i, --include-children limit also the children processes
-h, --help display this help and exit
TARGET must be exactly one of these:
-p, --pid=N pid of the process (implies -z)
-e, --exe=FILE name of the executable program file or path name
COMMAND [ARGS] run this command and limit it (implies -z)
So looks like I have to do it with the -e
flag.
Ideally however I would like to limit the entire user account.
And yes I know about cloudlinux but I can't do that right now. Until I can do that I need help doing it manually with something that doesn't require a server reboot.