#!/bin/bash interface='ppp0' script=`basename $0` # mydomain.com urls[0]='http://freedns.afraid.org/dynamic/update.php?...' # ftp.mydomain.com urls[1]='http://freedns.afraid.org/dynamic/update.php?...' # mail.mydomain.com urls[2]='http://freedns.afraid.org/dynamic/update.php?...' # www.mydomain.com urls[3]='http://freedns.afraid.org/dynamic/update.php?...' cache='/tmp/freedns-update.cache' ( ifconfig $interface &>/dev/null && test -w $cache ) || exit 0 newAddress=`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..." echo "$newAddress" > $cache for url in "${urls[@]}" do curl -s "$url" &>/dev/null sleep 1 let "urlIndex = $index + 1" done echo "$script: Done." fi