Created
March 18, 2014 15:03
-
-
Save njt1982/9621845 to your computer and use it in GitHub Desktop.
Domain IP Watcher
This file contains hidden or 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
#!/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