aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts/ifdown-ppp
diff options
context:
space:
mode:
Diffstat (limited to 'sysconfig/network-scripts/ifdown-ppp')
-rwxr-xr-xsysconfig/network-scripts/ifdown-ppp25
1 files changed, 18 insertions, 7 deletions
diff --git a/sysconfig/network-scripts/ifdown-ppp b/sysconfig/network-scripts/ifdown-ppp
index 3265c72d..282c22b0 100755
--- a/sysconfig/network-scripts/ifdown-ppp
+++ b/sysconfig/network-scripts/ifdown-ppp
@@ -7,7 +7,18 @@ cd /etc/sysconfig/network-scripts
CONFIG=$1
source_config
-file=/var/run/pppwatch-$DEVICE.pid
+if [ "${DEMAND}" != no -a -f /var/run/ppp-${DEVICE}.pid ] ; then
+ PID=`head -1 /var/run/ppp-${DEVICE}.pid`
+ kill -TERM ${PID}
+ sleep 2
+ [ ! -d /proc/${PID} ] && exit 0
+ kill -TERM ${PID}
+ sleep 2
+ [ ! -d /proc/${PID} ] && exit 0
+ exit 1
+fi
+
+file=/var/run/pppwatch-${DEVICE}.pid
if [ ! -f $file ]; then
# ppp isn't running, or we didn't start it
@@ -15,17 +26,17 @@ if [ ! -f $file ]; then
fi
PID=`cat $file`
-[ -n "$PID" ] || exit 1
+[ -n "${PID}" ] || exit 1
-kill -TERM $PID > /dev/null 2>&1
-[ ! -d /proc/$PID ] && exit 0
+kill -TERM ${PID} > /dev/null 2>&1
+[ ! -d /proc/${PID} ] && exit 0
sleep 2
-[ ! -d /proc/$PID ] && exit 0
+[ ! -d /proc/${PID} ] && exit 0
# killing ppp-watch twice in a row causes it to send a SIGKILL to pppd pgrp
-kill -TERM $PID > /dev/null 2>&1
+kill -TERM ${PID} > /dev/null 2>&1
# ip-down won't run in this case
/etc/sysconfig/network-scripts/ifdown-post $1
-[ ! -d /proc/$PID ] && exit 0
+[ ! -d /proc/${PID} ] && exit 0
exit 1