Dima and DeRobertis, thank-you for your help and suggestions with my
project (you'll remember that I was trying to establish a dial-up modem PPP
connection on a system while the ethernet/cable modem was down and then
continue to check in order to drop the PPP connection when the cable modem
returned to service.  Your comments have been useful.  I'd like you to
review the following script(s), if you have a moment, and mention any
changes that you would suggest.  I've tried running the script, and it has
parsing problems with the if statements, and I'd also appreciate some help
in that regard, also (I'm new to bash scripting).  I chose to use an
ip-up.local local script to mail me the ppp IP information so that if the
ppp connection were dropped by the ISP (not by the inetfeeler script) I
would get a notification each time a re-connection is made along with the
new IP.  I'm thinking that I would have cron run the inetfeeler script
every two or five minutes.

Thanks. again,
Lee Howard

/etc/ppp/inetfeeler :
#!/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
PPPDEV=ppp0                     # ppp
device name
IP1=209.197.0.6                 # To ping, Burgoyne Computer's
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

if [ -f pppup.flag
]; then
  /sbin/route del default
  /sbin/route add default gw $GWIP
$GWDEV
fi
if [ ! ping -c1 $IP1 || ! ping -c1 $IP2 || ! ping -c1 $IP3 ];
then
  if [ -f failedping.flag ]; then
    /sbin/route del default
    if [
! -f pppup.flag ]; then
      ( /usr/bin/wvdial $ISP )
      /bin/touch
pppup.flag
    else
      PPPIP=`/sbin/route | grep $PPPDEV | sed 's/^\([^
]*\) .*/\1/'`
      /sbin/route add default gw $PPPIP $PPPDEV
    fi

else
    touch failedping.flag
  fi
else
  rm -f failedping.flag
  if [ -f
pppup.flag ]; then
    WVPID=`ps -e | grep wvdial | sed 's/^\ *\([^\ ]*\)
.*/\1/'`
    ( /bin/kill -s 2 $WVPID )
    /bin/mail -s "inetfeeler:
$SYSTID PPP off" $MAILTO </dev/null
    rm -f pppup.flag
  fi
fi

/etc/ppp/ip-up.local :
#!/bin/sh
[EMAIL PROTECTED] # administrator e-mail
address
SYSTID=Providence               # system ID for mail subject
/sbin/ifconfig | grep -e 'P-t-P' \
  | /bin/mail -s "inetfeeler: $SYSTID PPP on" $MAILTO


-
To unsubscribe from this list: send the line "unsubscribe linux-ppp" in
the body of a message to [EMAIL PROTECTED]

Reply via email to