summaryrefslogtreecommitdiff
path: root/net-mgmt/flowscan/files/flowscan.sh
blob: 08e88d0a35a8e82104d4ff84e32ae14f6a2e960f (plain) (blame)
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
#! /bin/sh

# rc script for flowscan
# Andreas Klemm <andreas@FreeBSD.org>, So  25 M�r 2001 12:46:10 CEST
# $FreeBSD$

if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then
    echo "$0: Cannot determine the PREFIX" >&2
    exit 1
fi

awk=/usr/bin/awk
bindir=$PREFIX/var/db/flows/bin
grep=/usr/bin/grep
kill=/bin/kill
logfile=$PREFIX/var/db/flows/flowscan.log
perl=/usr/bin/perl
scandir=$PREFIX/var/db/flows

case "$1" in
'start')
	[ -x $bindir/flowscan ] \
	&& ( cd $scandir \
	&& $perl $bindir/flowscan \
		>> $logfile 2>&1 </dev/null \
		> /dev/null & ) \
	&& echo -n " flowscan"
	;;
 
'stop')
	pid=`ps -ax | $grep "$perl $bindir/flowscan" | $awk '{ print $1 }'`
	if [ -n "$pid" ]; then
		echo "killing flowscan"
		$kill $pid
	fi
	;;
esac

exit 0