Skip to content

Instantly share code, notes, and snippets.

@skhokhlov
Created July 3, 2014 12:43
Show Gist options
  • Save skhokhlov/b817362f11f660fda92e to your computer and use it in GitHub Desktop.
Save skhokhlov/b817362f11f660fda92e to your computer and use it in GitHub Desktop.
Dtdns updater
#!/bin/bash
IPADDR=`ifconfig -a | grep -A1 ed0 | grep inet | awk '{ print $2 }'`
LASTIP=`nslookup canth.dtdns.net ns1.darktech.org | grep -A1 canth |
grep Address | awk '{
print $2 }'`
echo -n "`date` - "
if [ "$IPADDR" != "$LASTIP" ]; then
echo -e "GET /api/autodns.cfm?id=canth&pw=xxxxxxx&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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment