]> git.pld-linux.org Git - projects/rc-scripts.git/blame - sysconfig/network-scripts/ifdown-ppp
massive :$
[projects/rc-scripts.git] / sysconfig / network-scripts / ifdown-ppp
CommitLineData
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
5PATH=/sbin:/usr/sbin:/bin:/usr/bin
6
7cd /etc/sysconfig/network-scripts
7e04fe0e 8. /etc/rc.d/init.d/functions.network
7742e157
AF
9
10CONFIG=$1
7742e157
AF
11source_config
12
13if [ ! -f /var/run/ppp-$DEVICE.dev ]; then
14 # ppp isn't running, or we didn't start it
15 exit 0
16fi
17
18file=/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).
22rm -f /var/run/ppp-$DEVICE.dev
23
24if [ ! -f $file ]; then
25 exit 0
26fi
27
28PID=`cat $file`
29if [ -z "$PID" ]; then
30 exit 1
31fi
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 36CHATPID=`ps axl | awk '$4 ~ /^'"$PID"'$/ {print $3}' 2>/dev/null`
7742e157
AF
37
38kill $PID > /dev/null 2>&1
39[ -n "$CHATPID" ] && kill $CHATPID > /dev/null 2>&1
40if [ ! -d /proc/$PID ]; then
41 /etc/sysconfig/network-scripts/ifdown-post $1
42 exit 0
43fi
44sleep 2
45if [ ! -d /proc/$PID ]; then
46 /etc/sysconfig/network-scripts/ifdown-post $1
47 exit 0
48fi
49
50kill -KILL $PID > /dev/null 2>&1
51if [ -d /proc/$PID ]; then
52 logger -p daemon.info -t ifdown-ppp "ifdown-ppp unable to kill pppd-$DEVICE" &
53else
54 /etc/sysconfig/network-scripts/ifdown-post $1
55fi
56
57exit 1
This page took 0.032552 seconds and 4 git commands to generate.