Welcome! 登入 註冊
美寶首頁 美寶百科 美寶論壇 美寶落格 美寶地圖

Advanced

[HOW TO] Auto Reconnect in ADSL/DSL with Script (Debian/SuSE)

Posted by HP 
[HOW TO] Auto Reconnect in ADSL/DSL with Script (Debian/SuSE)

分類標籤: Linux系統管理
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)



Edited 6 time(s). Last edit at 04/04/2010 04:05AM by HP.
(編輯記錄)