- Code: Select all
# /usr/local/cpanel/bin/cpuwatch
Usage: cpuwatch <maxload> (<-p PID>|<command> [arguments])
maxload : system load at which throttling should commence
command : command to run under cpuwatch
-p PID : monitor and throttle the existing process PID
Another neat feature is that it can fork a new process or attach itself to a running process, here is an example of deleting an account using SSH and setting the load average threshold to 4.0 :
- Code: Select all
/usr/local/cpanel/bin/cpuwatch 4.0 /scripts/killacct username
The load average will go past 4 however the process will stop running as it goes past that limit, if you already have a process running and you do not want to restart it all, you can run the following command to attach it to the process, in this case, the process ID of my process is 18274.
- Code: Select all
/usr/local/cpanel/bin/cpuwatch 4.0 -p 18274
It’s a very simple but very neat utility that has saved a few times when we had to do major file operations and did not want the server to have high load averages, this same binary is also used when the logs are running for cPanel and as well as when the cPanel backups are running. For example:
- Code: Select all
/usr/local/cpanel/bin/cpuwatch 5.0 /scripts/pkgacct nccsupp /backup/cpbackup/daily backup