From 6e0c34caad982aea1a6ad874589e04eb34857aa9 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 10 Apr 2012 00:51:34 +0200 Subject: Add local flowscan SysV init script. --- init.d/local-flowscan | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 init.d/local-flowscan (limited to 'init.d') 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 -- cgit v1.2.3