您的位置:首页 > 运维架构 > Linux

linux定期判断网站可否打开

2013-04-05 13:07 225 查看
wget http://www.shopindream.de/200.php  --timeout=2
c_monitor=$?
rm -rf 200.php
if [ ! $c_monitor = "0" ];
then
echo "# Error Cannot open shopindream.de, time: " $(date +"%y-%m-%d %H:%M:%S") "restart lnmp.. " | mail -s "Website is offline." 747890528@qq.com
/usr/local/php/sbin/php-fpm restart
service mysql restart
fi


  然后是设定权限:

chmod 777 /root/test200_monitor.sh


运行定时程序:

crontab -e


   输入以下内容每隔5分钟检测一次

*/5 * * * * /root/test200_monitor.sh
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: