diff options
author | Jeff Bilyk <jbilyk@gmail.com> | 2012-03-18 03:06:25 +0000 |
---|---|---|
committer | Jeff Bilyk <jbilyk@gmail.com> | 2012-03-18 03:06:25 +0000 |
commit | a3764b47b42f5c52a389ce28911ec8733aa456c6 (patch) | |
tree | 34b93bf6b117efe143a56efcd8098a02f99da122 /main/nfdump/nfcapd.initd | |
parent | 32e6ed3000de872f57a6fab1d00a609726216ae3 (diff) | |
download | aports-a3764b47b42f5c52a389ce28911ec8733aa456c6.tar.bz2 aports-a3764b47b42f5c52a389ce28911ec8733aa456c6.tar.xz |
main/nfdump: moved from testing
moved nfdump from testing to main
Diffstat (limited to 'main/nfdump/nfcapd.initd')
-rw-r--r-- | main/nfdump/nfcapd.initd | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/main/nfdump/nfcapd.initd b/main/nfdump/nfcapd.initd new file mode 100644 index 000000000..5f8506812 --- /dev/null +++ b/main/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 $? +} + + + + + + |