]>
Commit | Line | Data |
---|---|---|
6955eb97 | 1 | #!/bin/sh |
b0443108 | 2 | # |
cf37a775 | 3 | # $Id: ifdown-ppp,v 1.9 2000/04/21 17:44:22 jajcus Exp $ |
b0443108 | 4 | # |
7742e157 AF |
5 | PATH=/sbin:/usr/sbin:/bin:/usr/bin |
6 | ||
f3002e12 JK |
7 | . /etc/sysconfig/network |
8 | . /etc/rc.d/init.d/functions | |
8b3e2b71 | 9 | . /etc/sysconfig/network-scripts/.functions |
7742e157 AF |
10 | |
11 | CONFIG=$1 | |
7742e157 AF |
12 | source_config |
13 | ||
cf37a775 | 14 | if [ ! -f /var/run/ppp-$DEVICE.pid ]; then |
7742e157 AF |
15 | # ppp isn't running, or we didn't start it |
16 | exit 0 | |
17 | fi | |
18 | ||
cf37a775 | 19 | get_ppp_device_and_pid |
7742e157 | 20 | |
7742e157 AF |
21 | if [ -z "$PID" ]; then |
22 | exit 1 | |
23 | fi | |
24 | ||
cf37a775 JK |
25 | rm -f /var/run/ppp-$DEVICE.pid |
26 | ||
7742e157 AF |
27 | # pppd might have chat as a child; remember chat's pid to kill after pppd. |
28 | # (After, not before, so that pppd doesn't just restart it). | |
29 | ||
d29c401a | 30 | CHATPID=`ps axl | awk '$4 ~ /^'"$PID"'$/ {print $3}' 2>/dev/null` |
7742e157 AF |
31 | |
32 | kill $PID > /dev/null 2>&1 | |
33 | [ -n "$CHATPID" ] && kill $CHATPID > /dev/null 2>&1 | |
34 | if [ ! -d /proc/$PID ]; then | |
35 | /etc/sysconfig/network-scripts/ifdown-post $1 | |
36 | exit 0 | |
37 | fi | |
38 | sleep 2 | |
39 | if [ ! -d /proc/$PID ]; then | |
40 | /etc/sysconfig/network-scripts/ifdown-post $1 | |
41 | exit 0 | |
42 | fi | |
43 | ||
44 | kill -KILL $PID > /dev/null 2>&1 | |
45 | if [ -d /proc/$PID ]; then | |
46 | logger -p daemon.info -t ifdown-ppp "ifdown-ppp unable to kill pppd-$DEVICE" & | |
47 | else | |
48 | /etc/sysconfig/network-scripts/ifdown-post $1 | |
49 | fi | |
50 | ||
51 | exit 1 |