Skip to content

Instantly share code, notes, and snippets.

@andreagrandi
Created September 5, 2014 11:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreagrandi/695a776fc06c99a83c4c to your computer and use it in GitHub Desktop.
Save andreagrandi/695a776fc06c99a83c4c to your computer and use it in GitHub Desktop.
Ping an ip and print a different message if it can be pinged or not
keepalive_host='120.0.0.1'
ping -q -c1 $keepalive_host >> /dev/null
if [ "$?" -ne "0" ]; then
echo "Cannot ping!"
else
echo "PING!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment