Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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