summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'net-analyzer/pmacct/files/pmacctd-init.d')
-rw-r--r--net-analyzer/pmacct/files/pmacctd-init.d37
1 files changed, 37 insertions, 0 deletions
diff --git a/net-analyzer/pmacct/files/pmacctd-init.d b/net-analyzer/pmacct/files/pmacctd-init.d
new file mode 100644
index 000000000000..3a0cc734991c
--- /dev/null
+++ b/net-analyzer/pmacct/files/pmacctd-init.d
@@ -0,0 +1,37 @@
+#!/sbin/runscript
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+PMACCTDDIR=${PMACCTDDIR:-/etc/pmacctd}
+if [ ${SVCNAME} != "pmacctd" ]; then
+ PMACCTDPID="/run/${SVCNAME}.pid"
+else
+ PMACCTDPID="/run/pmacctd.pid"
+fi
+PMACCTDCONF="${PMACCTDDIR}/${SVCNAME}.conf"
+
+depend() {
+ need net
+}
+
+checkconfig() {
+ if [ ! -e ${PMACCTDCONF} ] ; then
+ eerror "You need an ${PMACCTDCONF} file to run pmacctd"
+ return 1
+ fi
+}
+
+start() {
+ checkconfig || return 1
+ ebegin "Starting ${SVCNAME}"
+ start-stop-daemon --start --pidfile "${PMACCTDPID}" --exec /usr/sbin/"${SVCNAME}" \
+ -- -D -f "${PMACCTDCONF}" -F "${PMACCTDPID}" ${OPTS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping ${SVCNAME}"
+ start-stop-daemon --stop --pidfile "${PMACCTDPID}" --exec /usr/sbin/"${SVCNAME}"
+ eend $?
+}