Skip to content

Instantly share code, notes, and snippets.

@j3tm0t0
Created February 13, 2014 17:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save j3tm0t0/8979884 to your computer and use it in GitHub Desktop.
Save j3tm0t0/8979884 to your computer and use it in GitHub Desktop.
healthcheck by ping
#!/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