2
04
2009
重启apache的bash脚本
bigCat Posted in Linux - for Comments = 2INFO=`netstat -ln | grep -P ":80"`
DATE=`date`
if [ "$INFO" == "" ]
then
/etc/init.d/httpd restart
echo "$DATE shit happens" >> /var/log/httprestart.log
ps aux | mail -s mt17down httprestart@ooxx.me
else
echo "$DATE pass" >> /var/log/httprestart.log
fi
*/1 * * * * /root/httprestart.sh >/dev/null 2>&1
求教:如果是返回500、502、504这种错误,$INFO=="" 吗?
也是apache的返回码..只要80还活着,就不会空
监控状态码可以模拟访问,提取文件头