Created
September 5, 2014 11:46
-
-
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
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
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