Skip to content

Instantly share code, notes, and snippets.

@sicdigital
Last active July 19, 2018 02:54
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 sicdigital/a7d35cb2ae6e5ff4f76adf75846483f0 to your computer and use it in GitHub Desktop.
Save sicdigital/a7d35cb2ae6e5ff4f76adf75846483f0 to your computer and use it in GitHub Desktop.
Shell script to ping a domain until it works. Lets the user know when DNS has resolved
((minutes = 720)) # Total minutes to run
((rc = 3)) # set to none 0 value
while [[ $minutes -ne 0 && $rc -ne 0 ]] ; do
ping -c 1 localhost # Try once.
rc=$?
if [[ $rc -eq 0 ]] ; then
echo `say The Domain is Resolving.`
else
echo 'Not Found'
((minutes = minutes - 1)) # So we don't go forever.
sleep 60; # Wait 60 seconds to check again/.
fi
done
if [[ $minutes -eq 0 ]] ; then # Make final determination.
echo `say Timeout.`
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment