#!/bin/sh # By Thierry Nkaoua. # All comments welcome to . # # Check every IPDELAY seconds that IP exists for ppp0 (better than ping...); # this is obtained by scanning "ifconfig ppp0" return (function getip()). If # ppp0 is down, then the adsl script is restarted to get a new connection. # Please modify the following file according to your configuration. # Added by . . /etc/adsl.conf # Check IPs from ifconfig getip() { IP=`$IFCONFIG/ifconfig ppp0 | fgrep "inet ad" | cut -f2 -d":" | cut -f1 -d" "` } echo "Starting checkip: " >> $LOG # Check if ppp0 is up; if it is not, restart the connection. while true; do sleep $IPDELAY getip if ! [ "$IP" ]; then $ADSL/adsl restart & break fi done