diff options
author | root <root@dgi-huset.dk> | 2012-04-10 00:51:34 +0200 |
---|---|---|
committer | root <root@dgi-huset.dk> | 2012-04-10 00:51:34 +0200 |
commit | 6e0c34caad982aea1a6ad874589e04eb34857aa9 (patch) | |
tree | d4c1d98c1b41b71d4575e69d99d43e11af7a0e6a | |
parent | a7ad206e9777ffbffc5700f1099950b0362604a6 (diff) |
Add local flowscan SysV init script.
-rwxr-xr-x | init.d/local-flowscan | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/init.d/local-flowscan b/init.d/local-flowscan new file mode 100755 index 0000000..171e20f --- /dev/null +++ b/init.d/local-flowscan @@ -0,0 +1,47 @@ +#!/bin/sh -e +# +# flowscan Transforms Cisco netflow files into rrd files. +# +# chkconfig: 345 20 20 +# +# description: Start / stop the netflow recorder + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/bin/flowscan +CONFIG=/etc/flowscan/flowscan.cf +DESC="netflow recorder" + +test -f $DAEMON || exit 0 +test -f $CONFIG || exit 0 + +startstop() { + local background= + [[ "$1" != "--start" ]] || background="--background" + start-stop-daemon "$@" $background --make-pidfile --name ${DAEMON##*/} \ + --pidfile="/var/run/${DAEMON##*/}.pid" --startas "$DAEMON" +} + +case "$1" in + start) + echo -n "Starting $DESC: " + startstop --start + echo "${DAEMON##*/}." + ;; + stop) + echo -n "Stopping $DESC: " + startstop --stop + echo "${DAEMON##*/}." + ;; + restart|force-reload) + echo -n "Reloading $DESC: " + startstop --stop --oknodo --quiet + startstop --start + echo "${DAEMON##*/}." + ;; + *) + echo "Usage: $0 {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 |