Magento服务器监控以及宕机邮件警报

#本脚本请实现yum安装curl和mutt
#请对应修改监控站以及宕机后发送邮箱,下方默认监控www.baidu.com
#如需重启其他服务或者监控不同状态,请自行修改

[email protected]
STATUS_OK="200"
status="$(curl -o /dev/null -s -m 10 --connect-timeout 10 -w %{http_code} 'http://www.baidu.com/')"
if [ $STATUS_OK != $status ]
then
service mysql restart
service varnish restart
service nginx restart
echo "AutoStart:" $(date +"%y-%m-%d %H:%M:%S") "restart server" > /root/autoreboot.log
echo "AutoStart: "$(date +"%y-%m-%d %H:%M:%S")" restart service" | mutt -s "the server is down" $MAIL_TO
else echo 'server is ok.' $(date +"%y-%m-%d %H:%M:%S") > /root/autoreboot.log
fi

发表评论

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

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

用户的评价

SHU88提供专业服务,并且有丰富的建站经验,回复都挺及时的,以后继续品牌之路。 ------------- 杭州沃熔科技