freebsd-ports/net-mgmt/flowscan/files/flowscan.sh
Andreas Klemm 5586d3519b - additional important port changes
- modify sample startup script
	- run in background properly
	- use variables for progs (grep, perl, kill, ...)
	- style (use $var consistently, spaces after io redirection)
- install startup script as cflowd-flowscan.sh.sample
  to get an order, cflowd ports startup script will be named
  cflowd-base.sh.sample, so that cflowd will be started first.
2001-03-25 13:23:36 +00:00

39 lines
764 B
Bash

#! /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