服务器宕机检测&自动重启
2012-02-14 14:44
316 查看
检测脚本:
vi monitor.sh
STATUS_OK="200"
status="$(curl --write-out %{http_code} -Is --connect-timeout 10 --output /dev/null 'http://dev.doudouy.cn/api/users/1.cn.json')"
if [ $STATUS_OK != $status ]
then service tomcat restart
else echo 'ddy sdk server is ok.'
定时任务:crontab -e
0 0/2 * * * * /opt/telenav/tools/monitor.sh
每两分钟检测一次服务器
http://stackoverflow.com/questions/2220301/how-to-evaluate-http-response-codes-from-bash-shell-script
vi monitor.sh
STATUS_OK="200"
status="$(curl --write-out %{http_code} -Is --connect-timeout 10 --output /dev/null 'http://dev.doudouy.cn/api/users/1.cn.json')"
if [ $STATUS_OK != $status ]
then service tomcat restart
else echo 'ddy sdk server is ok.'
定时任务:crontab -e
0 0/2 * * * * /opt/telenav/tools/monitor.sh
每两分钟检测一次服务器
http://stackoverflow.com/questions/2220301/how-to-evaluate-http-response-codes-from-bash-shell-script
相关文章推荐
- Linux检测websphere进程宕机后自动重启脚本
- expect自动检测并重启另外一台服务器上的程序代码
- 服务器自动重启,服务器宕机重启,自动重启weblogic,批处理自动重启服务器
- expect自动检测并重启另外一台服务器上的程序代码
- Tomcat服务器的监听及宕机自动重启的开发
- 自动化运维 | 如何实现服务器宕机后自动重启
- 自动重装,修改代码后无需重启服务器
- 自动重启server2003服务器
- linux deepin系统下tomcat宕机自动重启
- 从头认识Spring-2.7 自动检测Bean(3)-过滤器<context:exclude-filter/>
- 定时自动重启IIS和定时重启服务器
- 服务器凌晨莫名奇妙自动重启解决方案
- linux 进程自动重启检测脚本
- Linux下Tomcat自动检测和重启脚本
- node热部署,侦测改动自动重启服务器
- Linux定时检测tomcat状态,宕掉时自动重启
- Linux VPS服务器根据CPU负载及内存占用自动重启的bash shell脚本
- 服务器重启时自动进入模式选择状态的问题解决
- 解决eclipse+tomcat开发时候修改配置文件自动重启服务器问题
- 如何检测网络中断, 并自动重启网卡