Cron monitor for a unix service

Well, as I can’t do anything about these server blips due to running out of resources on the VPS, I’ve implemented a nasty little script


#!/bin/bash

pgrep apache2
if [ $? -ne 0 ]
then
/etc/init.d/apache2 restart
fi

this is then added to crontab to run every five minutes.


*/5 * * * * root /var/www/webmonitor.sh >/dev/null 2>&1

with any luck this’ll do for until I can fork out the extra cash required to get more memory. On the old box as it was dedicated it use swap more effectively, in the world of a vps, you hit the limit and it starts to shut down processes :frowning:

DT.