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