Hi. I thought that I'd share this script that I wrote with anyone who may
have use for it. I use it in root's cronttab to test if a LAN internet
connection drops, and if it does, to initiate a ppp connection while the
LAN connection remains disconnected. (This is for "problematic" DSL and
cable modem connections where connectivity is important.) You'll likely
want to change several things for your use... fping is a must (for timeout
purposes), but you can replace wvdial with whatever you like.
Lee Howard
#!/bin/sh
#
# inetfeeler - script to connect via ppp while eth gateway fails
#
# *** Configuration Information ***
#
GWIP=209.197.23.129 # Gateway IP number
GWDEV=eth0 # Gateway device name
IP1=209.197.0.6 # To ping, Burgoyne DNS
IP2=205.181.175.1 # To ping, EFortress DNS
IP3=208.23.84.2 # To ping, NetONE DNS
ISP=NetONE # wvdial.conf label for ppp ISP
[EMAIL PROTECTED] # administrator e-mail address
SYSTID=Providence # system ID for mail subject
PPPUP=`ps -e | grep wvdial | sed 's/^.* //g'`
if test -e pppup.flag; then
/sbin/route add -host $IP1 gw $GWIP $GWDEV
/sbin/route add -host $IP2 gw $GWIP $GWDEV
/sbin/route add -host $IP3 gw $GWIP $GWDEV
fi
if { ! /usr/sbin/fping -c1 $IP1 >/dev/null 2>&1 && \
! /usr/sbin/fping -c1 $IP2 >/dev/null 2>&1 && \
! /usr/sbin/fping -c1 $IP3 >/dev/null 2>&1; } then
if test -e failedping.flag; then
if test -e pppup.flag; then
/sbin/route del -host $IP1
/sbin/route del -host $IP2
/sbin/route del -host $IP3
else
/sbin/route del default
fi
if [ "$PPPUP" != "wvdial" ] ; then
/usr/bin/wvdial $ISP >/dev/null 2>&1 &
touch pppup.flag
fi
else
touch failedping.flag
fi
else
rm -f failedping.flag
if test -e pppup.flag; then
/sbin/route del -host $IP1
/sbin/route del -host $IP2
/sbin/route del -host $IP3
if [ ! "$PPPUP" != "wvdial" ] ; then
/sbin/route del default
/usr/bin/killall wvdial
fi
/sbin/route add default gw $GWIP $GWDEV
rm -f pppup.flag
/bin/mail -s "inetfeeler: $SYSTID PPP off" $MAILTO </dev/null >/dev/null
fi
fi
-
To unsubscribe from this list: send the line "unsubscribe linux-ppp" in
the body of a message to [EMAIL PROTECTED]