]>
Commit | Line | Data |
---|---|---|
6955eb97 | 1 | #!/bin/sh |
b0443108 | 2 | # |
7824432b | 3 | # $Id: ifdown-sl,v 1.10.2.2 2001/09/30 10:19:42 misiek Exp $ |
b0443108 | 4 | # |
7742e157 AF |
5 | PATH=/sbin:/usr/sbin:/bin:/usr/bin |
6 | ||
f3002e12 JK |
7 | . /etc/sysconfig/network |
8 | . /etc/rc.d/init.d/functions | |
7824432b | 9 | . /etc/sysconfig/network-scripts/functions.network |
7742e157 AF |
10 | |
11 | CONFIG=$1 | |
7742e157 AF |
12 | source_config |
13 | ||
a04d924e AM |
14 | # set all major variables |
15 | setup_ip_param | |
16 | ||
7742e157 AF |
17 | # signals ifup-sl not to persist |
18 | rm -f /var/run/sl-$DEVICE.dev | |
19 | ||
c24e165d | 20 | # we can use dip or direct slip connection via slattach |
dd4a755f | 21 | if is_no "$DIRECT_CONNECT"; then |
a04d924e | 22 | PID=$(pidof dip-$DEVICE) |
c24e165d | 23 | else |
a04d924e | 24 | PID=$(pidof slattach) |
c24e165d AM |
25 | for x in $PID; do |
26 | if grep -q "$MODEMPORT" /proc/$x/cmdline; then | |
a04d924e | 27 | logger -p daemon.info -t ifdown-sl "signal TERM send to \"$(ps -o cmd= $x)\" - this should be slattach" |
c24e165d AM |
28 | kill -TERM $x |
29 | PID=$x | |
30 | fi | |
31 | done | |
32 | fi | |
12de71be | 33 | # |
34 | # The proctitle for connected dip daemons is actually "-dip (ipaddr)" | |
830949ca | 35 | # with ipaddr = local on dial-out, remote on dial-in |
12de71be | 36 | # Grab the PID of connected dial-out daemon. |
37 | # | |
38 | if [ -z "$PID" ]; then | |
a04d924e | 39 | PID=$(pidof -- -dip\ \($IPADDR\)) |
12de71be | 40 | fi |
7742e157 AF |
41 | if [ -z "$PID" ]; then |
42 | exit 1 | |
43 | fi | |
44 | ||
45 | kill $PID > /dev/null 2>&1 | |
46 | if [ ! -d /proc/$PID ]; then | |
47 | /etc/sysconfig/network-scripts/ifdown-post $1 | |
48 | exit 0 | |
49 | fi | |
50 | sleep 2 | |
51 | if [ ! -d /proc/$PID ]; then | |
52 | /etc/sysconfig/network-scripts/ifdown-post $1 | |
53 | exit 0 | |
54 | fi | |
55 | ||
56 | kill -KILL $PID > /dev/null 2>&1 | |
57 | if [ -d /proc/$PID ]; then | |
7824432b | 58 | logger -p daemon.info -t ifdown-sl "$(nls 'ifdown-%s unable to kill %s for %s' "sl" "slattach" "$DEVICE")" & |
7742e157 AF |
59 | else |
60 | /etc/sysconfig/network-scripts/ifdown-post $1 | |
61 | fi | |
62 | ||
63 | exit 1 | |
64 | ||
a04d924e AM |
65 | |
66 | # This must be last line ! | |
67 | # vi:syntax=sh:tw=78:ts=8:sw=4 | |
68 |