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