mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-25 20:25:28 +03:00
fix url add !check remove unneeded code in apkbuild, cleanups remade init script (compatible with old one but more functional) [TT: fix localstatedir to /var, modernize slightly]
41 lines
1.3 KiB
Text
41 lines
1.3 KiB
Text
#!/sbin/openrc-run
|
|
|
|
name="Netflow probe"
|
|
description="NetFlow Probe"
|
|
command=/usr/sbin/softflowd
|
|
pidfile=/run/$RC_SVCNAME.pid
|
|
|
|
if [ -z "${RC_SVCNAME##*.*}" ]; then
|
|
_suffix=${RC_SVCNAME#*.}
|
|
SOFTFLOWD_INTERFACE=${_suffix%@*}
|
|
name="$name: $SOFTFLOWD_INTERFACE"
|
|
if [ -z "${_suffix##*@*}" ]; then
|
|
SOFTFLOWD_COLLECTOR=${_suffix#*@}
|
|
name="$name -> $SOFTFLOWD_COLLECTOR"
|
|
fi
|
|
command_args="-p $pidfile -c /run/$RC_SVCNAME.ctl"
|
|
elif [ "${SOFTFLOWD_INTERFACE##*:*}" ]; then
|
|
SOFTFLOWD_INTERFACE="${SOFTFLOWD_INTERFACE_IDX:+$SOFTFLOWD_INTERFACE_IDX:}$SOFTFLOWD_INTERFACE"
|
|
fi
|
|
|
|
command_args="-i $SOFTFLOWD_INTERFACE -n $SOFTFLOWD_COLLECTOR $command_args $SOFTFLOWD_EXTRA"
|
|
|
|
# legacy compatibility
|
|
command_args="$command_args ${SOFTFLOWD_TIMEOUTS:+-t $SOFTFLOWD_TIMEOUTS}"
|
|
command_args="$command_args ${SOFTFLOWD_MAXFLOWS:+-m $SOFTFLOWD_MAXFLOWS}"
|
|
|
|
depend() {
|
|
need net
|
|
}
|
|
|
|
start_pre() {
|
|
[ "$SOFTFLOWD_INTERFACE" -a "$SOFTFLOWD_COLLECTOR" ] && return 0
|
|
eerror Specify interface name in form [index:]ifname
|
|
eerror and collector host:port in /etc/conf.d/$RC_SVCNAME:
|
|
eerror " SOFTFLOWD_INTERFACE=eth0"
|
|
eerror " SOFTFLOWD_COLLECTOR=collector.host:9995"
|
|
eerror Or create an init script for each interface or interface@collector:
|
|
eerror " cd /etc/init.d"
|
|
eerror " ln -s softflowd softflowd.1:eth0@collector.host:9995"
|
|
return 1
|
|
}
|