Created
June 24, 2016 13:48
-
-
Save gertcuykens/bcbb7895fe29377cc597ea99117ab696 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
#IPADDR=`ifconfig -a | grep -A1 en0 | grep inet | awk '{ print $2 }'` | |
IPADDR=`curl -s ifconfig.me/ip` | |
LASTIP=`nslookup nyhostname.dtdns.net ns1.darktech.org | grep -A1 myhostname | | |
grep Address | awk '{ | |
print $2 }'` | |
echo -n "`date` - " | |
if [ "$IPADDR" != "$LASTIP" ]; then | |
echo -e "GET /api/autodns.cfm?id=myusername&pw=mypassword&client=BSD | |
HTTP/1.1\nHost: www.dtdns.com\nUser-Agent: bash\n\n" | \ | |
nc www.dtdns.com 80 > /dev/null 2>&1 | |
echo "Posted IP change from $LASTIP to $IPADDR" | |
else | |
echo "IP still $IPADDR" | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment