此脚本检测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]
2023年六月 一 二 三 四 五 六 日 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 -
近期文章