监控httpd服务一旦发现关闭从新开启每十分钟检测一次

#!/bin/bash
#auther:acf
#function:monitoring service of httpd
[root@my-cmp Desktop]#cat b.sh
a=`ps -A|grep httpd |grep -v grep|awk '{print $4}'|wc -l`
if [ $a != 0 ];then
echo "httpd is running..."
else echo "httpd was stoped,now httpd is starting..."
/etc/init.d/httpd start
fi
===

===接下来将其写入计划任务中
[root@my-cmp Desktop]# crontab -e
*/10 * * * * /bin/bash /root/Desktop/b.sh

posted @ 2015-02-01 16:24  大都比2号  阅读(216)  评论(0编辑  收藏  举报