summaryrefslogtreecommitdiffstats
path: root/testing/nfdump/nfcapd.initd
diff options
context:
space:
mode:
Diffstat (limited to 'testing/nfdump/nfcapd.initd')
-rw-r--r--testing/nfdump/nfcapd.initd63
1 files changed, 63 insertions, 0 deletions
diff --git a/testing/nfdump/nfcapd.initd b/testing/nfdump/nfcapd.initd
new file mode 100644
index 000000000..5f8506812
--- /dev/null
+++ b/testing/nfdump/nfcapd.initd
@@ -0,0 +1,63 @@
+#!/sbin/runscript
+# Copyright 2012 N Angelacos - Based on Gentoo Foundation fprobe script
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ need net
+ after firewall
+}
+
+
+BIN=/usr/bin/nfcapd
+PIDFILE_EXTRA=${SVCNAME#*.}
+if [ -n "${PIDFILE_EXTRA}" ] && [ ${SVCNAME} != "nfcapd" ]; then
+ PIDFILE="/var/run/nfcapd.${PIDFILE_EXTRA}.pid"
+else
+ PIDFILE="/var/run/nfcapd.pid"
+fi
+
+start() {
+ ebegin "Starting nfcapd"
+ local OPTS=""
+
+ [ -n "${SOURCE}" ] && SOURCE=`echo -n "${SOURCE}" | sed 's/ / -n /g'`
+ [ "${IPV4}" == "yes" ] && OPTS="${OPTS} -4"
+ [ "${IPV6}" == "yes" ] && OPTS="${OPTS} -6"
+ [ "${ALIGN}" == "yes" ] && OPTS="${OPTS} -w"
+ [ "${AUTOEXPIRE}" == "yes" ] && OPTS="${OPTS} -e"
+ [ "${COMPRESS}" == "yes" ] && OPTS="${OPTS} -z"
+ for optname in p:PORT b:BINDHOST j:MULTICASTGROUP i:IFACE R:REPEAT \
+ I:IDENT l:BASEDIR n:SOURCE s:SAMPLERATE S:SUBDIR \
+ T:EXTENSIONS t:INTERVAL x:ROTATECMD u:UID g:GID \
+ B:BUFFLEN ; do
+ opt="${optname/:*}" optvar="${optname/*:}"
+ eval optvalue="\$$optvar"
+ [ -n "$optvalue" ] && OPTS="${OPTS} -${opt} ${optvalue}"
+ done
+ OPTS="${OPTS}"
+
+ # Attempt to make the basedir if specified
+ if [ -n "${BASEDIR}" ]; then
+ mkdir -p "${BASEDIR}"
+ chown "${UID}":"${GID}" "${BASEDIR}"
+ fi
+
+
+ start-stop-daemon --start -b --exec $BIN \
+ --pidfile ${PIDFILE} --make-pidfile \
+ -- ${OPTS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping nfcapd"
+ start-stop-daemon --stop --quiet --exec $BIN \
+ --pidfile ${PIDFILE}
+ eend $?
+}
+
+
+
+
+
+