this script will ckeck if the partical process ( httpd , mysql . spamd ) ... will ckck every 10 minutes

#!/bin/sh
SERVICE=httpd\ mysqld\ spamd 

for i in $SERVICE
do
if ps ax | grep -v grep | grep $i > /dev/null
then
    echo "$i is  running!" | mail -s "$i is running everthings fine " agnello.dsouza@gmail.com
else
    echo "$i is not running"
/etc/init.d/$i
    echo "$SERVICE is not running!" | mail -s "$SERVICE down" agnello.dsouza@gmail.com
fi
 
crontab -e
*/10 * * * * /your/location/of/script
 
This works for me


--
Regards
Agnello Dsouza
www.linux-vashi.blogspot.com
www.bible-study-india.blogspot.com
 

0 comments