diff options
author | Josh Paetzel <jpaetzel@FreeBSD.org> | 2010-12-02 17:00:44 +0000 |
---|---|---|
committer | Josh Paetzel <jpaetzel@FreeBSD.org> | 2010-12-02 17:00:44 +0000 |
commit | e06ece098ed585ba4280e1f2c77eb33b520a2dc4 (patch) | |
tree | 4dba1c259c5baafea8aa51edad5bf1abfcc3a843 /net-mgmt | |
parent | 9ed83ffb46b3fcc21deb1b43e22eb1c363a715f3 (diff) | |
download | ports-e06ece098ed585ba4280e1f2c77eb33b520a2dc4.tar.gz ports-e06ece098ed585ba4280e1f2c77eb33b520a2dc4.zip |
Notes
Diffstat (limited to 'net-mgmt')
-rw-r--r-- | net-mgmt/softflowd/Makefile | 2 | ||||
-rw-r--r-- | net-mgmt/softflowd/files/softflowd.in | 99 |
2 files changed, 54 insertions, 47 deletions
diff --git a/net-mgmt/softflowd/Makefile b/net-mgmt/softflowd/Makefile index 628e639f5456..b970ccd2564d 100644 --- a/net-mgmt/softflowd/Makefile +++ b/net-mgmt/softflowd/Makefile @@ -7,7 +7,7 @@ PORTNAME= softflowd PORTVERSION= 0.9.8 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= net-mgmt ipv6 MASTER_SITES= http://www2.mindrot.org/files/softflowd/ diff --git a/net-mgmt/softflowd/files/softflowd.in b/net-mgmt/softflowd/files/softflowd.in index dd512de0c3ff..96247705c124 100644 --- a/net-mgmt/softflowd/files/softflowd.in +++ b/net-mgmt/softflowd/files/softflowd.in @@ -1,11 +1,11 @@ - #!/bin/sh -# (c) 2010 Tom Judge +# $FreeBSD$ + +# (c) 2010 Tom Judge # PROVIDE: softflowd -# REQUIRE: NETWORKING -# BEFORE: LOGIN +# REQUIRE: LOGIN # KEYWORD: shutdown # softflowd_enable="YES" @@ -19,57 +19,64 @@ # 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="" +. /etc/rc.subr name=softflowd rcvar=`set_rcvar` -load_rc_config $name + +start_precmd="softflowd_precommand $@" +stop_precmd="softflowd_precommand $@" +status_precmd="softflowd_precommand $@" +poll_precmd="softflowd_precommand $@" +rcvar_precmd="softflowd_precommand $@" stop_cmd="softflowd_stop" -command="/usr/local/sbin/softflowd" +command="%%PREFIX%%/sbin/softflowd" _pidprefix="/var/run/softflowd" +if [ -n $2 ]; then + pidfile="${_pidprefix}.${2}.pid" +fi + +load_rc_config $name -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}" +softflowd_enable=${softflowd_enable:-"NO"} +softflowd_timeouts="-t maxlife=300" +softflowd_max_states="16000" -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 +softflowd_precommand () +{ + if [ -n "$2" ]; then + profile="$2" + 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" ]; then + for profile in ${softflowd_interfaces}; do + echo "===> softflowd profile: ${profile}" + %%PREFIX%%/etc/rc.d/softflowd $1 ${profile} + retcode="$?" + if [ "0${retcode}" -ne 0 ]; then + failed="${profile} (${retcode}) ${failed:-}" + else + success="${profile} ${success:-}" + fi + done + fi + exit 0 fi -fi - -softflowd_stop() { - /usr/local/sbin/softflowctl -c ${ctlfile} shutdown } +softflowd_stop() +{ + %%PREFIX%%/sbin/softflowctl -c ${ctlfile} shutdown +} run_rc_command "$1" - - - |