Created
February 13, 2014 17:31
-
-
Save j3tm0t0/8979884 to your computer and use it in GitHub Desktop.
healthcheck by ping
This file contains 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/sh | |
count=3 | |
timeout=2 | |
success=0 | |
for ip in `echo $PATH_INFO | perl -pe 's#[^\d\./]##g;s#/#\ #g'` | |
do | |
ping $ip -c $count -W $timeout > /dev/null && success=1 | |
done | |
if [ "$success" = "0" ] | |
then | |
exit -1 | |
fi | |
cat << EOF | |
Content-type: text/plain | |
OK |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment