#!/bin/sh # By Thierry Nkaoua. # All comments welcome to . # # Script to start, restart or stop an ADSL connection with a PPTP client. # It also launches the checkip script that restarts ADSL if ppp0 is down. # It also launches the uddns script that updates a DNS adress if the IP has # changed. # Please modify the following file according to your configuration. # Added by . . /etc/adsl.conf # Check the IP from ifconfig. getip() { IP=`$IFCONFIG/ifconfig ppp0 | fgrep "inet ad" | cut -f2 -d":" | cut -f1 -d" "` } # Determine what the user want us to do. case "$1" in start) echo -------------------- >> $LOG echo `date` >> $LOG echo -n "Starting adsl: " >> $LOG echo -n "Starting adsl: " $PPTP/pptp $MODEM >> $LOG & $CHECKIP/checkip & $CHECKIP/uddns & ;; stop) echo -------------------- >> $LOG echo `date` >> $LOG echo -n "Shutting down adsl: " >> $LOG killall -w uddns > /dev/null killall -w checkip > /dev/null killall -w pptp > /dev/null killall -w pppd > /dev/null rm -fr /var/run/ppp0.pid /var/run/pptp/ echo Shutting down OK >> $LOG ;; status) [ -f /var/run/ppp0.pid ] && echo "ppp0 is up (PID `cat /var/run/ppp0.pid`)" getip [ "$IP" ] && echo "Local IP: $IP" ;; restart) echo -------------------- >> $LOG echo `date` >> $LOG echo "Restarting adsl: " >> $LOG $0 stop sleep $DELAY $0 start ;; *) echo "Usage: adsl {start|stop|status|restart}" exit 1 esac exit 0