Skip to content

Instantly share code, notes, and snippets.

@njt1982
Created March 18, 2014 15:03
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 njt1982/9621845 to your computer and use it in GitHub Desktop.
Save njt1982/9621845 to your computer and use it in GitHub Desktop.
Domain IP Watcher
#!/bin/sh
if [ $# -lt 1 ]; then
echo "USAGE: $0 [domain.com]"
exit 1
fi
DOMAIN=$1
INITIAL=$(dig $DOMAIN | grep -E 'IN.+A.+.+' | awk '{print $5}')
echo "Initial IP = $INITIAL"
while [ "$INITIAL" == "$(dig $DOMAIN | grep -E 'IN.+A.+.+' | awk '{print $5}')" ]
do
sleep 5
done
osascript -e 'tell app "System Events" to display dialog "The domains IP has changed" buttons {"OK"} default button 1 with title "IP Changed" with icon caution'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment