
# rc script for flowscan
# D Plonka, Jan 11 1999

bindir=/var/local/flows/bin
scandir=/var/local/flows
logfile=/var/local/flows/flowscan.log
user=net

su=/bin/su
nohup=/usr/bin/nohup
kill=/bin/kill
ps=/bin/ps
grep=/bin/grep
awk=/usr/bin/awk
perl=/usr/bin/perl
nice=/usr/bin/nice
meanness=0

case "$1" in
'start')
	echo "starting flowscan"
        ${nice} --${meanness} ${su} - ${user} -c "cd ${scandir} && ${nohup} ${perl} ${bindir}/flowscan >>${logfile} 2>&1 </dev/null &" >/dev/null
	;;
 
'stop')
	echo "killing flowscan"
        pid=`${ps} ax |${grep} "${perl} ${bindir}/[f]lowscan" |${awk} '{print $1}'`
	if [ -n "$pid" ]
	then
	   ${kill} $pid
	fi
	;;
esac
