Last active
July 19, 2018 02:54
-
-
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
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
((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