blob: f57f4d23b38e7810487bf6133f49193d7dd3b1d2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/ifplugd/files/gentoo-ifplugd-init-v2,v 1.3 2004/07/15 00:43:53 agriffis Exp $
#NB: Config is in /etc/conf.d/ifplugd
opts="stop start status suspend resume"
IFPLUGD=/usr/sbin/ifplugd
[ -z "$INTERFACES" ] && INTERFACES="eth0"
[ "$INTERFACES" = "auto" ] && INTERFACES=`cat /proc/net/dev | awk '{ print $1 }' | grep ^eth | cut -d: -f1`
# Handle starting for all interfaces
# $1 is extra args, $2 is action name
do_all_if() {
local status
for IF in $INTERFACES ; do
echo -n "$IF "
$IFPLUGD $1 -i $IF $ARGS
status=$?
[ $status -ne 0 ] && break
done
echo
eend $status "Couldn't $2 ifplugd for $IF"
}
start() {
einfon "Starting ifplugd: "
do_all_if "" start
}
stop() {
einfon "Stopping ifplugd: "
do_all_if -k stop
# Now we have to wait until it's actually down
local i=10
while [ $i -gt 0 ] && status | grep -q "running as"; do
i=$(( $i - 1 ))
sleep 1
done
if [ $i -eq 0 ]; then
eend 1 "Timeout exceeded, ifplugd won't die!"
fi
}
status() {
do_all_if -c "get status from"
}
suspend() {
einfon "Suspending ifplugd: "
do_all_if -S suspend
}
resume() {
einfon "Resuming ifplugd: "
do_all_if -R resume
}
# vim:ts=4
|