Created
April 29, 2015 12:35
-
-
Save andybeak/7f6c9d3607bbfb6a3fc2 to your computer and use it in GitHub Desktop.
Monitoring and restarting Varnish - Script from http://www.cyberciti.biz/tips/howto-linux-unix-write-to-syslog.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment