lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # $Id: pppoe_dail.sh,v 1.1 2007-09-26 01:33:21 winfred Exp $ |
| 4 | # |
| 5 | # usage: pppoe_dail.sh |
| 6 | # |
| 7 | # pppoe_dail.sh,v1.0 2010-09-09 10:00:00 maxiaoliang $ |
| 8 | # |
| 9 | # usage: pppoe_dail.sh |
| 10 | # |
| 11 | path_sh=`nv get path_sh` |
| 12 | . $path_sh/global.sh |
| 13 | echo "Info: pppoe_dail.sh start " >> $test_log |
| 14 | |
| 15 | usage() |
| 16 | { |
| 17 | echo "Usage:" |
| 18 | echo " $0 [connect | disconnect]" |
| 19 | exit 1 |
| 20 | } |
| 21 | if [ "$1" = "" ]; then |
| 22 | echo "$0: insufficient arguments" |
| 23 | usage $0 |
| 24 | fi |
| 25 | |
| 26 | killall pppoecd |
| 27 | |
| 28 | eth_dial_mode=`nv get ethwan_dialmode` |
| 29 | |
| 30 | idle_time=`nv get idle_time` |
| 31 | wan0=`nv get ethwan` |
| 32 | |
| 33 | if [ "$1" = "connect" ]; then |
| 34 | pppoe_user=`nv get pppoe_username` |
| 35 | pppoe_pass=`nv get pppoe_cc` |
| 36 | if [ "-${pppoe_user}" = "-" -a "-${pppoe_pass}" = "-" ];then |
| 37 | echo "WARN: pppoe_user is ${pppoe_user}, pppoe_pass is ${pppoe_pass}, so not connect pppoecd. " >> $test_log |
| 38 | else |
| 39 | #dial mode |
| 40 | if [ "$eth_dial_mode" == "auto" ]; then |
| 41 | pppoecd $wan0 -u $pppoe_user -p $pppoe_pass -N 2 -k & |
| 42 | elif [ "$eth_dial_mode" == "ondemand" ]; then |
| 43 | pppoecd $wan0 -u $pppoe_user -p $pppoe_pass -N 2 -i $idle_time -R -k & |
| 44 | elif [ "$eth_dial_mode" == "manual" ]; then |
| 45 | pppoecd $wan0 -u $pppoe_user -p $pppoe_pass -N 2 -k & |
| 46 | fi |
| 47 | fi |
| 48 | fi |
| 49 | |
| 50 | if [ "$1" = "disconnect" ]; then |
| 51 | echo "pppoe-down: pppoe is disconnected! " |
| 52 | sleep 2 |
| 53 | fi |
| 54 | |