Monday, January 24, 2005

:Linux: ppp0 auto reconnect

greetings
guys, I have ADSL through ppp0, How to set it to auto reconnect when
disconnected..
Thanks in advance


This script should do what you want.

============= reconnect_modem.sh =============
#!/bin/sh
#
# Script to check if modem is disconnected & try reconnecting
# Graham Smith - 01/02/2004
#
# set -x
result=$(/usr/bin/cinternet -i dsl0 -s | /usr/bin/grep disconnect)
#Checks the status of device dsl0 'disconnect'
if [ -n "$result" ]
then
/usr/bin/cinternet -i dsl0 -A #Start the interface.
sleep 10
else #The interface is up - Just exit
exit 0
fi
==================================

Just add the following line to your crontab, replacing with the path
you installed the script in. It checks to see if the modem has been disc
every 3 minutes.

4-59/3 * * * * /reconnect_modem.sh 2>&1 /dev/null

--
Regards,

Graham Smith


Thank you Graham!
& Thank you basem Narmoug

No comments:

Post a Comment