ports/151398: RC Script for net-mgmt/softflowd
Tom Judge
tom at tomjudge.com
Mon Oct 11 20:10:04 UTC 2010
>Number: 151398
>Category: ports
>Synopsis: RC Script for net-mgmt/softflowd
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: update
>Submitter-Id: current-users
>Arrival-Date: Mon Oct 11 20:10:03 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator: Tom Judge
>Release: 7.1
>Organization:
>Environment:
FreeBSD alfor.chi-dc.XXX 7.1-RELEASE-p4 FreeBSD 7.1-RELEASE-p4 #0 @718:817M: Tue Nov 24 02:31:49 UTC 2009 tj at dev-tj-7-1-amd64.chicago.XXX:/usr/obj/usr/src/sys/XXXv5 amd64
>Description:
The softflowd port does not currently include an rc(8) script.
The following script supports running multiple instances of softflowd on a host with different interfaces. Using settings such as:
softflowd_enable="YES"
softflowd_interfaces="em0 vlan2"
softflowd_em0_collector="sentinel.chi-dc.XXX:9998"
softflowd_vlan2_collector="sentinel.chi-dc.XXX:9996"
This script is based on the apache22 script and its method of building multiple instances. It seems cleaner than the method employed by openvpn.
>How-To-Repeat:
>Fix:
Place file in /usr/local/etc/rc.d/
Patch attached with submission follows:
#!/bin/sh
# (c) 2010 Tom Judge
# PROVIDE: softflowd
# REQUIRE: NETWORKING
# BEFORE: LOGIN
# KEYWORD: shutdown
# softflowd_enable="YES"
# softflowd_interfaces="em0 em1"
# softflowd_em0_collector="collector:1234"
# softflowd_em1_collector="collector:1235"
# softflowd_em0_timeouts="-t maxlife=300"
# softflowd_em1_timeouts="-t maxlife=600"
# softflowd_em0_max_states="16000"
# softflowd_em1_max_states="17000"
# softflowd_em0_extra_args=""
# softflowd_em1_extra_args=""
. "/etc/rc.subr"
softflowd_enable=${softflowd_enable:-"NO"}
softflowd_timeouts="-t maxlife=300"
softflowd_max_states="16000"
softflowd_extra_args=""
name=softflowd
rcvar=`set_rcvar`
load_rc_config $name
stop_cmd="softflowd_stop"
command="/usr/local/sbin/softflowd"
_pidprefix="/var/run/softflowd"
if [ -n "$2" ]; then
profile="$2"
pidfile="${_pidprefix}.${profile}.pid"
ctlfile="${_pidprefix}.${profile}.ctl"
eval apache22_flags="\${apache22_${profile}_flags:-${apache22_flags}}"
eval softflowd_collector="\${softflowd_${profile}_collector}"
if [ "x${softflowd_collector}" = "x" ]; then
echo "ERROR: You must specify a collector to send data to."
exit 1
fi
eval softflowd_timeouts="\${softflowd_${profile}_timeouts:-${softflowd_timeouts}}"
eval softflowd_max_states="\${softflowd_${profile}_max_states:-${softflowd_max_states}}"
eval softflowd_extra_args="\${softflowd_${profile}_extra_args:-${softflowd_extra_args}}"
command_args="-i ${profile} -n ${softflowd_collector} -m ${softflowd_max_states} -p ${pidfile} -c ${ctlfile} ${softflowd_timeouts} ${softflowd_extra_args}"
else
if [ "x${softflowd_interfaces}" != "x" -a "x$1" != "x" ]; then
for profile in ${softflowd_interfaces}; do
echo "===> softflowd profile: ${profile}"
/usr/local/etc/rc.d/softflowd $1 ${profile}
retcode="$?"
if [ "0${retcode}" -ne 0 ]; then
failed="${profile} (${retcode}) ${failed:-}"
else
success="${profile} ${success:-}"
fi
done
exit 0
fi
fi
softflowd_stop() {
/usr/local/sbin/softflowctl -c ${ctlfile} shutdown
}
run_rc_command "$1"
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list