blob: fc1269f65c21010a1f862fd915c7ef110c502ee8 [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001#!/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#
11path_sh=`nv get path_sh`
12. $path_sh/global.sh
13echo "Info: pppoe_dail.sh start " >> $test_log
14
15usage()
16{
17 echo "Usage:"
18 echo " $0 [connect | disconnect]"
19 exit 1
20}
21if [ "$1" = "" ]; then
22 echo "$0: insufficient arguments"
23 usage $0
24fi
25
26killall pppoecd
27
28eth_dial_mode=`nv get ethwan_dialmode`
29
30idle_time=`nv get idle_time`
31wan0=`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