Chris Dzombak

Very Simple Dynamic DNS Client

I have recently found a need for a Dynamic DNS client for my desktop. This, based on a script from Jeremy Zawodny, is what I’ve come up with:


cd $HOME

LAST_IP=`cat .last_ip`
IP=`curl -s -o -`

if [ $LAST_IP != $IP ]; then
    echo "Twitter @$T_USER..."
    curl -s -o /dev/null -u $T_USER:$T_PASS -d status="$IP" $T_URL
    echo "FreeDNS..."
    curl -s
    echo "$IP" > .last_ip
    echo "Updated FreeDNS and @$T_USER to $IP"

This is, of course, a bash script - meaning it is for *nix systems. It’s supposed to be run via a cron job (mine is set to run every 5 minutes). The script is very self-explanatory.

Right now, it updates FreeDNS and a Twitter account with my latest IP.

One note: if you use this, make sure that ~/.last_ip is not empty, even the first time you run the script. This will cause the script to fail on line 12 - bash ends up trying to run something like if [ != ], which is obviously not correct.