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

时间:2015-02-01 17:37:00   收藏:0   阅读:323

#!/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

原文:http://www.cnblogs.com/blog-acf/p/4265662.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!