apache自动重启检测脚本

此脚本检测apache的启动情况,每分钟检测一次,服务停止后自动重启,并且发送邮件提示:[shell]
#RESTART="/sbin/service httpd restart"
RESTART="/sbin/service httpd start"
PGREP="/usr/bin/pgrep"
HTTPD="httpd"
$PGREP ${HTTPD}
if [ $? -ne 0 ]
then
#mail -s ‘apache stop’ hellogxp@163.com < /usr/bin/apachest.txt
$RESTART
mail -s ‘apache re’ hellogxp@163.com < /usr/bin/apachere.txt
fi[/shell]
然后加入自动运行[shell]
* * * * * root /usr/bin/apachere.sh > /dev/null 2>&1[/shell]

Avatar photo

About Blackford

这是个最好的时代,这是个最坏的时代,这是个充满希望的春天,这是个令人绝望的冬天,我们前面什么都有,我们前面什么都没有。梦想,让我们一次次的走远,又一次次的回头,一个关于人生的梦想还在不断奔跑,带着喜悦和疼痛,不过一切才刚刚开始,并且直到今天也远远没有结束
This entry was posted in 架构运维 and tagged , , . Bookmark the permalink.

发表评论

电子邮件地址不会被公开。 必填项已用*标注