Don't forget to install dnsutils
The original
############################################################################## # # application name: dnsactual # other files: dnsactual.conf (keeps the last updated ip) # dnsactual.log (register date & time of the actualization) # Author: Ernest Danton # Date: 01/29/2007 ############################################################################## if test -f /etc/freedns/dnsactual.conf then CacheIP=$(cat /etc/freedns/dnsactual.conf) fi #echo $CacheIP CurreIP=$(wget http://freedns.afraid.org/dynamic/check.php -o /dev/null -O /dev/stdout | grep Detected | cut -d : -f 2 | cut -d '<' - f 1 | tr -d " ") #echo $CurreIP if [ "$CurreIP" = "$CacheIP" ] then # Both IP are equal echo "Update not required..." else # The IP has change echo "Updating http://free.afraid.org with " $CurreIP wget http://freedns.afraid.org/dynamic/update.php?xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -o /dev/null -O /dev/stdout echo `date` "Updating log with IP " $CurreIP >> dnsactual.log fi rm -f /etc/freedns/dnsactual.conf echo $CurreIP > /etc/freedns/dnsactual.conf
This is what I worked it into
############################################################################## # # application name: dnsactual. orginally from Ernest Danton 01/29/07 # # I chaned it to to make more sense to me, but it is mostly the same # # ############################################################################## echo `date` "running dnsactual.sh " >> /home/pi/freedns/dnsrun.log CurreIP=$(wget http://freedns.afraid.org/dynamic/check.php -o /dev/null -O /dev/stdout | grep Detected | cut -d : -f 2 | cut -d '<' -f 1 | tr -d " ") echo $CurreIP > myip.conf DOMAIN="www.domain-name.org" registered=$(nslookup $DOMAIN|tail -n2|grep A|sed s/[^0-9.]//g) echo $registered > /home/pi/freedns/dnslkup.txt if [ "$CurreIP" = "$registered" ] then # Both IP are equal echo `date` "Update not required..Current IP " $CurreIP > /home/pi/freedns/dnsactual.log else # The IP has change echo "Updating http://free.afraid.org with " $CurreIP wget http://freedns.afraid.org/dynamic/update.php?xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -o /dev/null -O /dev/stdout echo `date` "Updating log with IP " $CurreIP > /home/pi/freedns/dnsactual.log echo `date` "Updating log with IP " $CurreIP >> /home/pi/freedns/dnschange.log fi