#!/bin/bash interface='ppp0' script=`basename $0` urls[0]='http://freedns.afraid.org/dynamic/update.php?hash' cache='/var/cache/freedns-update.cache' ( /sbin/ifconfig $interface &>/dev/null && test -w $cache ) || exit 0 newAddress=`/sbin/ifconfig $interface | grep inet | sed 's/addr://g' | awk '{print($2)}'` oldAddress=`head -1 $cache` if [ "$newAddress" != "$oldAddress" ] then echo -e "$script: Updating FreeDNS domains..." for url in "${urls[@]}" do curl -s "$url" &>/dev/null sleep 1 done echo "$newAddress" > $cache echo "$script: Done." fi