
# 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=/usr/bin/su
nohup=/usr/xpg4/bin/nohup
kill=/usr/bin/kill
ps=/usr/bin/ps
grep=/usr/xpg4/bin/grep
awk=/usr/xpg4/bin/awk
nice=/usr/xpg4/bin/nice
meanness=0

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