Monday, November 17, 2003

Dynamic DNS Update Script


#!/bin/ksh
echo start >> update.log
date >> update.log
lynx -dump http://192.168.123.254/status.htm | grep 'IP Address' > new-ip.dat
cat new-ip.dat >> update.log
ip=`sed -e 's/IP Address//; s/ //g' new-ip.dat`
if [ $ip = "0.0.0.0" ]
then
echo reviving connection >> update.log
ping -c 1 www.google.com > /dev/null
ping -c 1 www.paypal.com > /dev/null
echo revival quick exit >> update.log
rm new-ip.dat
exit
fi
echo checking for change >> update.log
cmp new-ip.dat cur-ip.dat > /dev/null
if [ $? != 0 ]
then
echo change detected >> update.log
cp new-ip.dat cur-ip.dat
echo change detected >> update.log
cp new-ip.dat cur-ip.dat

echo ------.fw.nu sitelutions.com
lynx -dump "https://www.sitelutions.com/dnsup?user=xxxxx&pass=yyyyyy&id=zzzzzzz&ip=$ip" >> update.log

echo check ok? for ae.dyndns.org >> update.log
if [ "`sed -e 's/ .*$//' last-update.dat`" == "good" ]
then
echo go for update ae.dyndns.org >> update.log
lynx -dump -auth=xxx:yyy "https://members.dyndns.org/nic/update?hostname=zzz.dyndns.org&myip=${ip}" > last-update.dat
fi
fi
echo exiting >> update.log
rm new-ip.dat

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home