aboutsummaryrefslogtreecommitdiffstats
path: root/community/softflowd/softflowd.initd
diff options
context:
space:
mode:
authorLeonardo Arena <rnalrd@alpinelinux.org>2016-03-28 06:48:50 +0000
committerLeonardo Arena <rnalrd@alpinelinux.org>2016-03-28 06:48:50 +0000
commitaa50c9d2c9b5368cdf3f09561484a958ff921521 (patch)
treeffc0f786e0e80e7f678a36e3ce517592c17e3ea7 /community/softflowd/softflowd.initd
parent5313047db607dd40fb5f8f5624f3d48055be2929 (diff)
downloadaports-aa50c9d2c9b5368cdf3f09561484a958ff921521.tar.bz2
aports-aa50c9d2c9b5368cdf3f09561484a958ff921521.tar.xz
community/softflowd: moved from testing
Diffstat (limited to 'community/softflowd/softflowd.initd')
-rw-r--r--community/softflowd/softflowd.initd55
1 files changed, 55 insertions, 0 deletions
diff --git a/community/softflowd/softflowd.initd b/community/softflowd/softflowd.initd
new file mode 100644
index 0000000000..3cf1e4231b
--- /dev/null
+++ b/community/softflowd/softflowd.initd
@@ -0,0 +1,55 @@
+#!/sbin/openrc-run
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/softflowd/files/softflowd.initd,v 1.2 2012/03/21 07:52:49 robbat2 Exp $
+
+depend() {
+ need net
+}
+
+softflowd_checkconfig() {
+ SOFTFLOWD_INTERFACE=${SVCNAME#*.}
+ if [ ${SOFTFLOWD_INTERFACE} = ${SVCNAME} ]; then
+ eerror "You have to create an init script for each interface:"
+ eerror "ln -s softflowd /etc/init.d/softflowd.eth0"
+ return 1
+ fi
+
+ if [ -z "${SOFTFLOWD_COLLECTOR}" ]; then
+ eerror "Specify the host and port that the accounting datagrams are to be"
+ eerror "sent to in /etc/conf.d/${SVCNAME}."
+ eerror "Example: SOFTFLOWD_COLLECTOR=collector.example.com:9995"
+ return 1
+ fi
+ SOFTFLOWD_PIDFILE="/var/run/softflowd.${SOFTFLOWD_INTERFACE}.pid"
+ SOFTFLOWD_CTLFILE="/var/run/softflowd.${SOFTFLOWD_INTERFACE}.ctl"
+}
+
+
+start() {
+ softflowd_checkconfig || return 1
+
+ ebegin "Starting softflowd on interface ${SOFTFLOWD_INTERFACE}"
+ iface_arg=${SOFTFLOWD_INTERFACE}
+ [ -n "${SOFTFLOWD_INTERFACE_IDX}" ] && iface_arg="${SOFTFLOWD_INTERFACE_IDX}:${iface_arg}"
+ start-stop-daemon --start \
+ --exec /usr/sbin/softflowd \
+ -- -i "${iface_arg}" \
+ -n "${SOFTFLOWD_COLLECTOR}" \
+ -p "${SOFTFLOWD_PIDFILE}" \
+ -c "${SOFTFLOWD_CTLFILE}" \
+ -t "${SOFTFLOWD_TIMEOUTS-maxlife=600}" \
+ -m "${SOFTFLOWD_MAXFLOWS-17000}" \
+ ${SOFTFLOWD_EXTRA}
+ eend $?
+}
+
+stop() {
+ softflowd_checkconfig || return 1
+
+ ebegin "Stopping softflowd on interface ${SOFTFLOWD_INTERFACE}"
+ # use softflowd's own way to shut it down
+ /usr/sbin/softflowctl -c ${SOFTFLOWD_CTLFILE} shutdown
+ eend $?
+}
+