Cakephp – JsController could not be found
August 16, 2009Overlength date field error in prestashop
December 12, 2009Some times one of the hosting servers is going crazy with load of over 200 crashing the server eventually.
The load is because of a strange php script that I can not find it for now. Anyway if you want to restart apache when your server load is too big and to receive an email when this happens here you go:
#!/bin/bash
MAXLOAD="5"
L05="$(uptime | gawk -F"load average: " '{ print $2 }' | gawk -F", " '{ print $1 }')"
if [ $(echo "$L05 > $MAXLOAD"|bc) -eq 1 ]
then
unlink /tmp/message.txt
MESSAGE="/tmp/message.txt"
echo "restarting apache" >> $MESSAGE
/bin/mail -s "big load $L05" "myemail" < $MESSAGE
/etc/init.d/httpd restart
fi
feel free to add it to your cron job
1 Comment
Thanks, I needed that 😉