1. The Script: (Just copy it and vi /usr/bin/repppoe)
Script for Debian:
#!/bin/bash
if !ping -c 3 www.google.com > /dev/null 2>&1
then
#/usr/bin/poff
#/usr/bin/pon dsl-provider
/usr/bin/pon ppp0
fi
The command for starting network in Debian is /usr/bin/pon and /sbin/ifup for SUSE. The device name for DSL may be dsl0 in SUSE.
So, the script for SUSE is like:
#!/bin/bash
if !ping -c 3 www.google.com > /dev/null 2>&1
then
#/usr/bin/poff
#/usr/bin/pon dsl-provider
/sbin/ifup dsl0
fi
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 may set other numbers of minutes for it.
Reference (in Chinese):
1. Debian Linux: Auto Reconnecting Script in ADSL PPPoE (2007)
2. Script to Auto Detect the down link of ADSL (2007)
Script for Debian:
#!/bin/bash
if !ping -c 3 www.google.com > /dev/null 2>&1
then
#/usr/bin/poff
#/usr/bin/pon dsl-provider
/usr/bin/pon ppp0
fi
The command for starting network in Debian is /usr/bin/pon and /sbin/ifup for SUSE. The device name for DSL may be dsl0 in SUSE.
So, the script for SUSE is like:
#!/bin/bash
if !ping -c 3 www.google.com > /dev/null 2>&1
then
#/usr/bin/poff
#/usr/bin/pon dsl-provider
/sbin/ifup dsl0
fi
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 may set other numbers of minutes for it.
Reference (in Chinese):
1. Debian Linux: Auto Reconnecting Script in ADSL PPPoE (2007)
2. Script to Auto Detect the down link of ADSL (2007)