Script to kill Roundcube stuck process

In the monitoring process many time, we receive the roundcube eating 100% cpu on the server and we can use the following script to kill stucked roundcube process.Create the new file roundcube.sh and insert the following code.

#!/bin/sh
for ROUNDCUBE in `ps aux | grep roundcube | awk -F ” ” ‘{print $10}’ | awk -F “:” ‘{print $1}’`;
do
if [ $ROUNDCUBE -ge 20 ]; then
pkill -u cpanelroundcube
echo “kill roundcube process roundcube”;
fi
done

You can add the cron job to run the above script after a specific time period, if you are facing the roundcube cpu usage issue continuously.Add following line under the crontab by using the crontab -e, it will run the cron after every 10 minutes.

*/10 * * * * sh /root/roundcube.sh;

About Anant 386 Articles
Senior technical writer