Created
January 8, 2017 23:10
-
-
Save spencerwi/931e75d5dd2918bba9680dc3614de879 to your computer and use it in GitHub Desktop.
ping-until-up.sh
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/bash | |
### | |
# Pings a host until the host responds. | |
### | |
if [ "$#" -gt 0 ] ; then | |
IS_LIVE=false; | |
while ! $IS_LIVE ; do | |
ping -c4 "$1"; | |
if [ "$?" -eq 0 ]; then | |
IS_LIVE=true; | |
fi; | |
done; | |
else | |
echo "usage: $0 HOST" | |
exit 1; | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment