>Hi, I have a Linux 1.2.3 machine at home that I connect to the Net with
>pppd and chat. I am trying to find a script that will check the net
>connection every 10 mins or so and reset my ppp connection if something
>has gone wrong with it. Does anyone know of a script that does this well.
>I have tried to utilise the ip-down script but it doesn't seem to be very
>reliable in that if it doesn't connect again on it's first attempt after a
>problem, it dies and doesn't try to connect again. I'm sure I am doing
>something wrong. If anyone has a bullet-proof method, your help would be
>greatly appreciated! Please e-mail me also!
>Mojoski
I have a simple one that calls my startup script (actually, I went to a 56k
frame relay connection, and don't use PPP anymore for full time).
#!/bin/sh
# Script to check to see if the link is up and restart it if not.
# runs from cron every ten minutes
# Sean Utt Mon May 1 18:16:16 PDT 1995
# change the target to something near you ...
# change the chatter variable too...
# ping -c 1 does one ping only...
Target="199.2.96.37"
Chatter="chatcat"
if test `ping -c 1 ${Target} 2> /dev/null |tail -1 |cut -f1 -d " "|cut -c1-2` =
ro
then exit 0
else
kill `ps -x | grep ${Chatter} |grep -v grep|cut -c0-6`
sleep 30
echo "pppd has been restarted on `date`"
exec /root/ppp/startup
fi
startup of course calls the chat routine and does all that stuff...
chatcat is the chat script that startup calls, and that is a unique identifier
out of ps that I can use to keep from killing other ppp connections dialed in.
put this in your crontab to run every 15 minutes, and all will be fine.
--
Autobahn Internet Services Inc. P.O. Box 1247 Sherwood, OR 97140
Charting a Course to the Future with WebMaster Sean at the Helm
Online Catalogs - Dial Up Access - Consulting - Custom Programming
http://www.Northwest.com/index.html Call or Fax: 503-774-3352