I thought I would return some effort to the list after all I got out of it,
so... here's my suite of automatic redialer scripts. They ride on and depend
on the PPP scripts that come with the distribution.
----script 1: multidial----
#!/bin/sh
# This is a script to loop through the call to ppp-up until connected
# or times out (about 5 minutes as coded here)
#
# Jonathan Markevich Feb 1998
#
COUNTER=60
localip=0.0.0.0
remoteip=
device=/dev/modem
pppflags="57600 modem defaultroute"
# Loop until PPP is established
while [ ! -e /var/run/ppp0.pid ]
do
if test $COUNTER -gt 0
then
# call ppp-up. If already running it will be
# ignored.
/etc/ppp/ppp-up
sleep 5
let COUNTER=$COUNTER-1
continue
else
# exit with an error code
exit 1
fi
done
# PPP has been established but wait until connection stabilizes.
# Use YaST to set up your NNTPSERVER environment variable first!
COUNTER=0
while ! ping -c 2 $NNTPSERVER &> /dev/null
do
sleep 1
if test $COUNTER -eq 60
then
# Exit with error code after 60 seconds
exit 1
fi
let COUNTER=$COUNTER+1
done
exit 0
---------------------------
----script 2: maildial----
#!/bin/sh
# braindead example script of how to use script 1
# Note: fetchpop is not a SuSE package!
if /etc/ppp/multidial
then
# it worked! Transfer the mail.
fetchpop -r -a
sendmail -q
/etc/ppp/ppp-down
fi
--------------------------
----script 3: hangup----
#!/bin/sh
# Just made to kill the dialing if it really needs it!
kill -SIGINT `ps | grep "/usr/sbin/chat" | gawk '{ print $1 }'`
------------------------
Please let me know if you can see any improvements. I am just learning shell
scripting!
Thanks!
---
Jonathan Markevich