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