
# rc script for cflowd 2.x
# D Plonka, May  3 1999

bindir=/opt/local/sbin
logfile=/dev/null
conf=/opt/local/etc/cflowd.conf
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
niceness=0

case "$1" in
'start')
	echo "starting cflowdmux"
	${nice} --${niceness} ${su} - ${user} -c "${bindir}/cflowdmux ${conf}"
	echo "starting cflowd"
	${nice} --${niceness} ${su} - ${user} -c "${bindir}/cflowd -s 300 -O 0 -m ${conf}"
	;;
 
'stop')
	echo "killing cflowd"
        pid=`${ps} -fu${user} |${grep} "${bindir}/[c]flowd" |${awk} '{print $2}'`
	if [ -n "$pid" ]
	then
	   ${kill} $pid
	fi

	echo "killing cflowdmux"
        pid=`${ps} -fu${user} |${grep} "${bindir}/[c]flowdmux" |${awk} '{print $2}'`
	if [ -n "$pid" ]
	then
	   ${kill} $pid
	fi
	;;
esac
