]> git.pld-linux.org Git - projects/rc-scripts.git/blob - lib/ifdown-sl
- provide stdin for the daemons that just must have it,
[projects/rc-scripts.git] / lib / ifdown-sl
1 #!/bin/sh
2 #
3 #       $Id$
4 #
5 PATH=/sbin:/usr/sbin:/bin:/usr/bin
6
7 . /etc/sysconfig/network
8 . /etc/rc.d/init.d/functions
9 . /lib/rc-scripts/functions.network
10
11 CONFIG=$1
12 source_config
13
14 # set all major variables
15 setup_ip_param
16
17 # signals ifup-sl not to persist
18 rm -f /var/run/sl-$DEVICE.dev
19
20 # we can use dip or direct slip connection via slattach
21 if is_no "$DIRECT_CONNECT"; then
22         PID=$(pidof dip-$DEVICE)
23 else
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
33 fi
34 #
35 # The proctitle for connected dip daemons is actually "-dip (ipaddr)"
36 #       with ipaddr = local on dial-out,  remote on dial-in
37 # Grab the PID of connected dial-out daemon.
38 #
39 if [ -z "$PID" ]; then
40         PID=$(pidof -- -dip\ \($IPADDR\))
41 fi
42 if [ -z "$PID" ]; then
43         exit 1
44 fi
45
46 kill $PID > /dev/null 2>&1
47 if [ ! -d /proc/$PID ]; then
48         /lib/rc-scripts/ifdown-post $1
49         exit 0
50 fi
51 sleep 2
52 if [ ! -d /proc/$PID ]; then
53         /lib/rc-scripts/ifdown-post $1
54         exit 0
55 fi
56
57 kill -KILL $PID > /dev/null 2>&1
58 if [ -d /proc/$PID ]; then
59         logger -p daemon.info -t ifdown-sl "ifdown-sl unable to kill sl-$DEVICE" &
60 else
61         /lib/rc-scripts/ifdown-post $1
62 fi
63
64 exit 1
This page took 0.030018 seconds and 3 git commands to generate.