sh 监控并重新启动Varnish - 来自http://www.cyberciti.biz/tips/howto-linux-unix-write-to-syslog.html的脚本
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 监控并重新启动Varnish - 来自http://www.cyberciti.biz/tips/howto-linux-unix-write-to-syslog.html的脚本相关的知识,希望对你有一定的参考价值。
#!/bin/bash
# Script from http://www.cyberciti.biz/tips/howto-linux-unix-write-to-syslog.html
result=$(echo -e "ping\n\r" | nc localhost 6082|grep PONG|wc -l);
if [ "${result}" -lt "1" ];
then
/etc/init.d/varnish stop;
sleep 5;
/etc/init.d/varnish start;
logger Varnish restart
fi
sleep 5;
results=$(echo -e "ping\n\r" | nc localhost 6082|grep PONG|wc -l);
if [ "${results}" -lt "1" ];
then
/etc/init.d/varnish stop;
sleep 5;
/etc/init.d/varnish start;
logger Second Varnish restart
fi
exit 0;
以上是关于sh 监控并重新启动Varnish - 来自http://www.cyberciti.biz/tips/howto-linux-unix-write-to-syslog.html的脚本的主要内容,如果未能解决你的问题,请参考以下文章
shell脚本判断进程是不是存在,并重新启动
Varnish CentOS - 错误 503 后端获取失败
守护进程监控tomcat并自己主动重新启动
如何监控`preStop`命令的执行?
varnish
监控varnish的缓存命中率