Skip to content

Instantly share code, notes, and snippets.

@evexoio evexoio/dns-notify.sh
Last active Apr 17, 2018

Embed
What would you like to do?
Monitor website's ip changes
# Author: Sam - @evexoio
if [[ $# -eq 0 ]]
then
echo "No domain supplied"
echo "Usage: bash dns-notify.sh example.com"
exit 1;
fi
sleep_time=10 # time to wait between tries
cache=`dig +short $1 | cat`
refresh=$cache
while [[ $cache = $refresh ]]
do
echo "[$cache] DNS changes not reflected yet...";
sleep $sleep_time;
refresh=`dig +short $1 | cat`
done;
success_msg="[$refresh] Hooray! DNS reflected on domain!"
if ! [ -x "$(command -v say)" ]; then # echo success msg if you can't say it
echo $success_msg
else
say $success_msg
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.