Skip to content

Instantly share code, notes, and snippets.

@gertcuykens
Created June 24, 2016 13:48
Show Gist options
  • Save gertcuykens/bcbb7895fe29377cc597ea99117ab696 to your computer and use it in GitHub Desktop.
Save gertcuykens/bcbb7895fe29377cc597ea99117ab696 to your computer and use it in GitHub Desktop.
#!/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