#! /bin/sh # by Thierry Nkaoua # all comments welcome to tnka@linux-sottises.net # sript to update dns name at www.dyndns.org # It keeps trying to update IP at www.dyndns.org till il gets a zero return code (update OK) # ipcheck.py from http://ipcheck.sourceforge.net/ is used and deals with # abuse (no update id done if ip is the same) and update after 28 days with same ip # Please modify the following file according to your configuration. # Added by . . /etc/adsl.conf # getip gets and ppp0 IP by scanning "ifconfig ppp0" return # IP is stored # Check IPs from ifconfig and savefile. getip() { IP=`$IFCONFIG/ifconfig ppp0 | fgrep "inet ad" | cut -f2 -d":" | cut -f1 -d" "` OLDIP=`cat $CHECKIP/pptp.ip` } # sleep $DDNSDELAY RETVAL=1 while [ $RETVAL -ne 0 ];do echo Starting ddns >> $LOG getip if [ "$IP" ]; then if [ "$OLDIP" != "$IP" ]; then echo -n "old IP: " >> $LOG echo $OLDIP >> $LOG echo -n "new IP: " >> $LOG echo $IP >> $LOG else echo same IP >> $LOG fi python $DDNS/ipcheck.py -a $IP -d $DDNS login password serveur1 serveur2 serveur3 >>$LOG # python $DDNS/ipcheck.py -a $IP test test test.dyndns.org >> $LOG RETVAL=$? [ $RETVAL -eq 0 ] && echo -n "$IP" > $CHECKIP/pptp.ip [ $RETVAL -ne 0 ] && rm $DDNS/ipcheck.err > /dev/null else echo panic ddns: no IP available >> $LOG sleep $DDNSDELAY fi done