Date: Mon, 26 Mar 2012 15:45:45 GMT From: moto kawasaki <moto@kawasaki3.org> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/166417: rc script for net/delegate (ports) Message-ID: <201203261545.q2QFjjP0082918@red.freebsd.org> Resent-Message-ID: <201203261550.q2QFoCtj084317@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 166417 >Category: ports >Synopsis: rc script for net/delegate (ports) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Mon Mar 26 15:50:12 UTC 2012 >Closed-Date: >Last-Modified: >Originator: moto kawasaki >Release: FreeBSD 8.2-RELEASE-p5 amd64 >Organization: >Environment: FreeBSD rt2.kawasaki3.org 8.2-RELEASE-p5 FreeBSD 8.2-RELEASE-p5 #0: Sun Dec 25 13:43:25 JST 2011 root@rt2.kawasaki3.org:/usr/obj/usr/src/sys/RT2 amd64 >Description: "delegate is a multi-purpose application leel gateway" as shown in its home page, http://www.delegate.org/, and FreeBSD Ports collection contains it in net/delegate. The start-up script, installed as /usr/local/etc/rc.d/delegated.sh-dist, is not an rc-script style one but a simple start up without stop/restart/status features. >How-To-Repeat: # cd /usr/ports/net/delegate # make install # cd /usr/local/etc/rc.d # more delegated.sh-dist >Fix: I'd like to suggest an rc-script style one as follows. ================================================================================ #!/bin/sh # moto kawasaki $Id$ # # PROVIDE: delegated # REQUIRE: LOGIN # KEYWORD: shutdown # delegated_enable_desc="enable/disable to run delegated" delegated_enable_defval="No" # delegated_ports_desc="list of [IP to bind:]<port> on which a delgated runs. ex) \"10.200.200.200:8080 8443\"" delegated_ports_defval="" # delegated_confdir_desc="Path to a directory in which delegated config files exist. Please don't include \"-P<port>\" in config files." delegated_confdir_defval="/usr/local/etc/delegated" # delegated_piddir_desc="Path to a directory in which delegated stores pid files" delegated_piddir_defval="/var/spool/delegate-nobody/act/pid" # . /etc/rc.subr name=delegated rcvar="delegated_enable delegated_ports delegated_confidr delegated_piddir" : ${delegated_enable:=${delegated_enable_defval}} : ${delegated_ports:=${delegated_ports_defval}} : ${delegated_confdir:=${delegated_confdir_defval}} : ${delegated_piddir:=${delegated_piddir_defval}} load_rc_config $name command=/usr/local/sbin/${name} pidfile=/dev/null start_cmd="${name}_start" stop_cmd="${name}_stop" status_cmd="${name}_status" delegated_start() { for i in ${delegated_ports} do if [ -r ${delegated_confdir}/${i}.conf ] then echo "${delegated_confdir}/${i}.conf found" ${command} -P${i} +=${delegated_confdir}/${i}.conf else echo "${delegated_confdir}/${i}.conf not found" 1>&2 fi done } delegated_stop() { for i in ${delegated_ports} do ${command} -P${i} -Fkill done } delegated_status() { for i in `ls ${delegated_piddir}` do echo "${i}: `cat ${delegated_piddir}/${i}`" done } run_rc_command "$1" ================================================================================ >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203261545.q2QFjjP0082918>