We all are aware of the fact that while packaging accounts, the load on the server spikes, and we need to monitor the load simultaneously to maintain stability. Most of the time we renice the process to +19 0r +20. But sometimes ,this will not solve the purpose, load will keep going up.
I recently learnt an alternative for the same.
# /usr/local/cpanel/bin/cpuwatch 8 /scripts/pkgacct <account>
# /usr/local/cpanel/bin/cpuwatch 8 -p <PID>
What cpuwatch does is that it executes the command and monitors the load, if the load goes beyond the set limit, it will stop the application and resume it after the load averages are below the threshold for a few seconds.
In the above case, the threshold avg load is 8.0, the process will be paused when the load goes above 8.0 and resumed when less than 8.0.We can set this threshold limit as per our requirement.
This way we can effectively package accounts on the server and have a check on load at the same time.