File: flow-tools.flow-capture.init

package info (click to toggle)
flow-tools 1%3A0.68-10
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 5,120 kB
  • ctags: 5,259
  • sloc: ansic: 43,197; sh: 1,611; perl: 661; python: 629; yacc: 303; makefile: 206; lex: 49
file content (66 lines) | stat: -rw-r--r-- 1,417 bytes parent folder | download
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
62
63
64
65
66
#!/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>

### BEGIN INIT INFO
# Provides:          flow-capture
# Required-Start:    $local_fs $remote_fs $syslog $network $time
# Required-Stop:     $local_fs $remote_fs $syslog $network
# Default-Start:     2 3 4 5
# Default-Stop:      S 0 1 6
# Short-Description: collects NetFlow data
### END INIT INFO

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='
'
	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