From owner-freebsd-rc@FreeBSD.ORG Sat Aug 20 23:23:49 2011 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id CF2F5106564A; Sat, 20 Aug 2011 23:23:49 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-198-245.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 14D8F15329B; Sat, 20 Aug 2011 23:22:51 +0000 (UTC) Message-ID: <4E5041CA.3030108@FreeBSD.org> Date: Sat, 20 Aug 2011 16:22:50 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:6.0) Gecko/20110819 Thunderbird/6.0 MIME-Version: 1.0 To: Chris Rees References: In-Reply-To: X-Enigmail-Version: undefined OpenPGP: id=1A1ABC84 Content-Type: multipart/mixed; boundary="------------090308050902010701040002" Cc: freebsd-rc@freebsd.org, Colin Percival Subject: Re: RC script for spiped (cperciva's latest invention) X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 23:23:49 -0000 This is a multi-part message in MIME format. --------------090308050902010701040002 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 08/20/2011 02:41, Chris Rees wrote: > Hi all, > > Colin's submitted a port for his spiped program, with an rc script and > I figure I should get it reviewed after my tweaks. > > Please refer to [1] for the provisional file, and the original PR is at [2]. > > Thanks! > > Chris > > [1] http://www.bayofrum.net/~crees/patches/spiped-rc-script > > [2] http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/159899 Attached is a patch that includes a couple of minor style issues, and more importantly local'izing the variables used in the functions. Otherwise it looks good to me. hth, Doug -- Nothin' ever doesn't change, but nothin' changes much. -- OK Go Breadth of IT experience, and depth of knowledge in the DNS. Yours for the right price. :) http://SupersetSolutions.com/ --------------090308050902010701040002 Content-Type: text/plain; name="spiped-rc-script.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="spiped-rc-script.diff" --- spiped-rc-script.orig 2011-08-20 04:25:09.000000000 -0700 +++ spiped-rc-script 2011-08-20 16:21:17.000000000 -0700 @@ -19,20 +19,22 @@ . /etc/rc.subr name="spiped" -start_cmd="${name}_start" -stop_cmd="${name}_stop" rcvar=${name}_enable -command=%%PREFIX%%/bin/${name} - load_rc_config $name : ${spiped_enable="NO"} +command=%%PREFIX%%/bin/${name} +start_cmd="${name}_start" +stop_cmd="${name}_stop" + spiped_start() { + local P PIDFILE MODE SOURCE TARGET KEY MODEFLAG + for P in ${spiped_pipes}; do - PIDFILE=/var/run/spiped_$P.pid + PIDFILE=/var/run/spiped_${P}.pid eval MODE=\$spiped_pipe_${P}_mode eval SOURCE=\$spiped_pipe_${P}_source eval TARGET=\$spiped_pipe_${P}_target @@ -54,8 +56,10 @@ spiped_stop() { + local P PIDFILE + for P in ${spiped_pipes}; do - PIDFILE=/var/run/spiped_$P.pid + PIDFILE=/var/run/spiped_${P}.pid if [ -f $PIDFILE ] ; then rc_pid=$(check_pidfile $PIDFILE $command) fi --------------090308050902010701040002--