add plugin (3g-modem-manager)
[vuplus_dvbapp] / lib / python / Plugins / SystemPlugins / 3GModemManager / script / ppp-stop
1 #!/bin/sh
2 DEVICE=ppp0
3
4 unload()
5 {
6         modprobe -r ppp_deflate
7         modprobe -r bsd_comp
8         modprobe -r ppp_async
9         modprobe -r slhc
10         modprobe -r ppp_generic
11 }
12
13 if [ -r /var/run/$DEVICE.pid ]; then                                 
14         kill -INT `cat /var/run/$DEVICE.pid`                         
15         exec /etc/ppp/ip-down                                   
16 fi
17
18 if ps x | fgrep "options.demand" 1> /dev/null 2> /dev/null ; then
19         D="echo Demand Dialing Stoped."
20 fi
21
22 if [ -r /var/run/$DEVICE.pid ]; then
23         kill -INT `cat /var/run/$DEVICE.pid`
24
25         if [ ! "$?" = "0" ]; then
26                 killall -INT pppd 2>/dev/null
27                 rm -f /var/run/$DEVICE.pid
28                 rm -f /var/lock/LCK*
29                 echo "ERROR: No pppd process running, removed stale pid file."
30                 exit 1
31         fi
32
33         unload
34         echo "PPP link to [$DEVICE] terminated."
35         $D
36         if [ "$1" = "-d" ]; then
37                 pppd file "/etc/ppp/options.demand" || exit 1
38                 echo "Demand Dialing Started."
39                 exit 0
40         elif [ "$2" = "-d" ]; then
41                 pppd file "/etc/ppp/options.demand" || exit 1
42                 echo "Demand Dialing Started."
43                 exit 0
44         else
45                 exit 0
46         fi
47 fi
48 echo "ERROR: PPP link is not active on: [$DEVICE]"
49 unload
50 exit 1