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
|
#!/bin/sh -e
#
# flow-capture Captures flow PDU's from a Cisco router.
#
# Written by Miquel van Smoorenburg <miquels@cistron.nl>.
# Modified for Debian GNU/Linux by
# Ian Murdock <imurdock@gnu.ai.mit.edu> and
# Anibal Monsalve Salazar <A.Monsalve.Salazar@IEEE.org>
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/flow-capture
CONFIG=/etc/flow-tools/flow-capture.conf
NAME=flow-capture
DESC=flow-capture
test -f $DAEMON || exit 0
test -f $CONFIG || exit 0
pid=`pidof $DAEMON` || true
case "$1" in
start)
if [ "$pid" ]; then
echo "Sorry, flow-capture is already running."
exit 0
fi
IFS=$'\n'
lines=`grep -E " |\t" /etc/flow-tools/flow-capture.conf | grep -v "^#"`
echo -n "Starting $DESC: "
for args in $lines; do
IFS=$' '
$DAEMON ${args}
done
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
pid=`pidof $DAEMON` || true
if [ "$pid" ]; then
kill -TERM $pid >/dev/null 2>&1
fi
echo "$NAME."
;;
restart|force-reload)
$0 stop
$0 start
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
|