1. The Script: (vi /usr/bin/repppoe)
#!/bin/bash
if !ping -c 3 www.google.com > /dev/null 2>&1
then
#/usr/bin/poff
#/usr/bin/pon dsl-provider
/sbin/ifup ppp0
fi
The starting command (ifup) in Debian is
/usr/bin/pon. The device name for ifup may be
dsl0 in SUSE.
2. chmod +x /usr/bin/repppoe
3. crontab (as root)
Shell> crontab -e
*/5 * * * * /usr/bin/repppoe
It means to check the script every 5 minutes. You set other numbers of minutes for it.
Reference (in Chinses):
1.
Debian Linux: Auto Reconnecting Script in ADSL PPPoE (2007)
2.
Script to Auto Detect the down link of ADSL (2007)