aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts/ifdown-ppp
diff options
context:
space:
mode:
authorMichael K. Johnson <johnsonm@redhat.com>1999-09-07 01:48:59 +0000
committerMichael K. Johnson <johnsonm@redhat.com>1999-09-07 01:48:59 +0000
commit9488c4cdd6895c00ca4e521473f488955d45a308 (patch)
treeaef8be5163d91f42bd39eef1551018cacec1f29f /sysconfig/network-scripts/ifdown-ppp
parent57487e296e885786382588f547d259bec4c3595e (diff)
downloadinitscripts-9488c4cdd6895c00ca4e521473f488955d45a308.tar
initscripts-9488c4cdd6895c00ca4e521473f488955d45a308.tar.gz
initscripts-9488c4cdd6895c00ca4e521473f488955d45a308.tar.bz2
initscripts-9488c4cdd6895c00ca4e521473f488955d45a308.tar.xz
initscripts-9488c4cdd6895c00ca4e521473f488955d45a308.zip
first attempt at integrating ppp-watch
Diffstat (limited to 'sysconfig/network-scripts/ifdown-ppp')
-rwxr-xr-xsysconfig/network-scripts/ifdown-ppp45
1 files changed, 11 insertions, 34 deletions
diff --git a/sysconfig/network-scripts/ifdown-ppp b/sysconfig/network-scripts/ifdown-ppp
index 6f1d90ca..2e56b0c0 100755
--- a/sysconfig/network-scripts/ifdown-ppp
+++ b/sysconfig/network-scripts/ifdown-ppp
@@ -7,47 +7,24 @@ cd /etc/sysconfig/network-scripts
CONFIG=$1
source_config
-if [ ! -f /var/run/ppp-$DEVICE.pid ]; then
- # ppp isn't running, or we didn't start it
- exit 0
-fi
-
-file=/var/run/ppp-$DEVICE.pid
-
-# signals ifup-ppp not to persist -- must do this before exiting if PPP
-# has not yet started ($file does not exist).
-rm -f /var/run/ppp-$DEVICE.dev
+file=/var/run/pppwatch-$DEVICE.pid
if [ ! -f $file ]; then
+ # ppp isn't running, or we didn't start it
exit 0
fi
-PID=`head -1 $file`
-if [ -z "$PID" ]; then
- exit 1
-fi
-
-# pppd might have chat/wvdial as a child; remember its pid to kill after pppd.
-# (After, not before, so that pppd doesn't just restart it).
-
-CHATPID=`ps axl | awk '$4 ~ /^'"$PID"'$/ {print $3}' 2>/dev/null`
+PID=`cat $file`
+[ -n "$PID" ] || exit 1
-kill $PID > /dev/null 2>&1
-[ -n "$CHATPID" ] && kill $CHATPID > /dev/null 2>&1
-if [ ! -d /proc/$PID ]; then
- exit 0
-fi
+kill -TERM $PID > /dev/null 2>&1
+[ ! -d /proc/$PID ] && exit 0
sleep 2
-if [ ! -d /proc/$PID ]; then
- exit 0
-fi
+[ ! -d /proc/$PID ] && exit 0
-kill -KILL $PID > /dev/null 2>&1
-if [ -d /proc/$PID ]; then
- logger -p daemon.info -t ifdown-ppp "ifdown-ppp unable to kill pppd-$DEVICE" &
-else
- # ip-down won't run in this case
- /etc/sysconfig/network-scripts/ifdown-post $1
-fi
+# killing ppp-watch twice in a row causes it to send a SIGKILL to pppd pgrp
+kill -TERM $PID > /dev/null 2>&1
+# ip-down won't run in this case
+/etc/sysconfig/network-scripts/ifdown-post $1
exit 1