502.sh:
export LC_ALL=zh_CN.UTF-8
#网站url地址
URL="http://cndo.org/"
#获取http响应代码
HTTP_CODE=`curl -o /dev/null -s -w "%{http_code}" "${URL}"`
#服务器能正常响应,应该返回200的代码
if [ $HTTP_CODE != '200' ];then
#重启服务
service httpd restart
service mysqld restart
fi
chmod +x 502.sh
#5分钟执行一次
crontab -e
*/3 * * * * /bin/sh /data/wwwroot/shell/502.sh
签名:这个人很懒,什么也没有留下!