service automated restart

Ok… it’s got pretty late here, and tomorrow is another day of work… but before I hit the sack… for those interested in keeping up services running on their server, here is a little bash cron script which could be modified or alterated to keep up any services/daemons running.

Please note this is a tip, so you migth need to modify things around to fit your needs… just giving out the idea here :-)

for mysql service for instance

/usr/bin/pgrep mysqld

if [ $? -eq 0 ]
then
/etc/init.d/mysqld restart
fi

So… from there, you could easily develop it and make it more sophisticated… like email you for instance etc…

peace,

Leave a Reply