#!/bin/bash
#自动检测URL是否挂了
while true
do
URL=" http://bbs.example.cn"
RETURN=`curl -o /dev/null -s -w "%{http_code}" "${URL}"`
if [ $RETURN != '200' ];then
/data/sh/fastcgi_restart
fi
sleep 12
done
本文介绍了一个使用bash编写的简单脚本,该脚本能够周期性地检查指定URL的状态码,并在状态码不是200时重启fastcgi服务。通过这个脚本可以实现基本的网站健康监测。
#!/bin/bash
#自动检测URL是否挂了
while true
do
URL=" http://bbs.example.cn"
RETURN=`curl -o /dev/null -s -w "%{http_code}" "${URL}"`
if [ $RETURN != '200' ];then
/data/sh/fastcgi_restart
fi
sleep 12
done
1198
880
497

被折叠的 条评论
为什么被折叠?