]> git.pld-linux.org Git - projects/rc-scripts.git/blame - lib/ifdown-sl
- provide stdin for the daemons that just must have it,
[projects/rc-scripts.git] / lib / ifdown-sl
CommitLineData
6955eb97 1#!/bin/sh
b0443108 2#
ec8b15cb 3# $Id$
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
f67ce454 9. /lib/rc-scripts/functions.network
7742e157
AF
10
11CONFIG=$1
7742e157
AF
12source_config
13
de1fc6ce
JR
14# set all major variables
15setup_ip_param
16
7742e157
AF
17# signals ifup-sl not to persist
18rm -f /var/run/sl-$DEVICE.dev
19
c24e165d 20# we can use dip or direct slip connection via slattach
dd4a755f 21if is_no "$DIRECT_CONNECT"; then
5e6dfc29 22 PID=$(pidof dip-$DEVICE)
c24e165d 23else
5e6dfc29
JR
24 PID=$(pidof slattach)
25 for x in $PID; do
26 if grep -q "$MODEMPORT" /proc/$x/cmdline; then
27 logger -p daemon.info -t ifdown-sl \
28 "signal TERM send to \"$(ps -o cmd= $x)\" - this should be slattach"
29 kill -TERM $x
30 PID=$x
31 fi
32 done
c24e165d 33fi
12de71be 34#
35# The proctitle for connected dip daemons is actually "-dip (ipaddr)"
830949ca 36# with ipaddr = local on dial-out, remote on dial-in
12de71be 37# Grab the PID of connected dial-out daemon.
38#
39if [ -z "$PID" ]; then
5e6dfc29 40 PID=$(pidof -- -dip\ \($IPADDR\))
12de71be 41fi
7742e157 42if [ -z "$PID" ]; then
5e6dfc29 43 exit 1
7742e157
AF
44fi
45
46kill $PID > /dev/null 2>&1
47if [ ! -d /proc/$PID ]; then
f67ce454 48 /lib/rc-scripts/ifdown-post $1
5e6dfc29 49 exit 0
7742e157
AF
50fi
51sleep 2
52if [ ! -d /proc/$PID ]; then
f67ce454 53 /lib/rc-scripts/ifdown-post $1
5e6dfc29 54 exit 0
7742e157
AF
55fi
56
57kill -KILL $PID > /dev/null 2>&1
58if [ -d /proc/$PID ]; then
5e6dfc29 59 logger -p daemon.info -t ifdown-sl "ifdown-sl unable to kill sl-$DEVICE" &
7742e157 60else
f67ce454 61 /lib/rc-scripts/ifdown-post $1
7742e157
AF
62fi
63
64exit 1
This page took 0.093643 seconds and 4 git commands to generate.