RC script for spiped (cperciva's latest invention)

Doug Barton dougb at FreeBSD.org
Sat Aug 20 23:23:49 UTC 2011


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/

-------------- next part --------------
--- 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


More information about the freebsd-rc mailing list