Skip to content

Instantly share code, notes, and snippets.

@spencerwi
Created January 8, 2017 23:10
Show Gist options
  • Save spencerwi/931e75d5dd2918bba9680dc3614de879 to your computer and use it in GitHub Desktop.
Save spencerwi/931e75d5dd2918bba9680dc3614de879 to your computer and use it in GitHub Desktop.
ping-until-up.sh
#!/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