>>problem. I am trying to write a shell script to check if the modem is
>>still connected and if not reconnect with the internet provider. Have been
here's how i do it..some of it is taken from the dynamic-ip howto (thanks
mike)..
if i can't ping nameserver, ppp0 must be down; run ppp-off to kill pppd,
which doesn't always die when connection is lost. then start ppp-on again
keep-ppp-up
-----------
#!/bin/bash
sleep 2
int=1
while [ $int = 1 ]
do
ping -c1 204.179.169.2 2>&1 | grep -- "0 packets" > /dev/null && { /root/bin/ppp-off > /dev/null ; kill -9 `/sbin/pidof pppd 2 > /dev/null`; sleep 2 ; /root/bin/ppp-on }
sleep 60
done
ppp-off
-------
#!/bin/sh
DEVICE=ppp0
#
# If the ppp0 pid file is present then the program is running. Stop it.
if [ -r /var/run/$DEVICE.pid ]; then
kill -INT `cat /var/run/$DEVICE.pid`
#
# If unsuccessful, ensure that the pid file is removed.
#
if [ ! "$?" = "0" ]; then
echo "removing stale $DEVICE pid file."
rm -f /var/run/$DEVICE.pid
exit 1
fi
#
# Success. Terminate with proper status.
#
echo "$DEVICE link terminated"
exit 0
fi
#
# The link is not active
#
echo "$DEVICE link is not active"
exit 1
ppp-on
------
#!/bin/sh
modprobe ppp
modprobe bsd_comp
/usr/sbin/pppd connect '/usr/sbin/chat -v -f /etc/ppp/pppscript' /dev/cua1 38400 debug crtscts modem persist defaultroute &
pppscript
---------
ABORT BUSY ABORT 'NO DIAL TONE' '' ATZ OK ATDT6495667 CONNECT '' ogin:--ogin: name word: password
sorry it's so long, but i know there are a million different ways people
have ppp setup so i thought i'd put everything
xn