rc.subr exits prematurely

Peter Pentchev roam at ringlet.net
Tue Jul 27 05:37:15 PDT 2004


Hi,

With the recent changes to rc.subr so that it executes port startup scripts
in the same shell instead of in a subshell, another problem has come up.
For the scripts which record a PID file, a check is made on startup and on
shutdown for the PID file's existence, and if it fails, rc.subr exits, which
prevents the rest of the scripts from being executed.  Attached is a quick
patch which works around this problem, but may introduce others - I'm not
quite sure I understand all of rc.subr's internal workings :)

G'luck,
Peter

-- 
Peter Pentchev	roam at ringlet.net    roam at cnsys.bg    roam at FreeBSD.org
PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
If I were you, who would be reading this sentence?
-------------- next part --------------
Index: src/etc/rc.subr
===================================================================
RCS file: /home/ncvs/src/etc/rc.subr,v
retrieving revision 1.30
diff -u -r1.30 rc.subr
--- src/etc/rc.subr	4 Jul 2004 07:21:18 -0000	1.30
+++ src/etc/rc.subr	26 Jul 2004 12:40:16 -0000
@@ -592,7 +592,7 @@
 		start)
 			if [ -z "$rc_fast" -a -n "$rc_pid" ]; then
 				echo "${name} already running? (pid=$rc_pid)."
-				exit 1
+				return 1
 			fi
 
 			if [ ! -x ${_chroot}${command} ]; then
@@ -675,14 +675,14 @@
 
 		stop)
 			if [ -z "$rc_pid" ]; then
-				[ -n "$rc_fast" ] && exit 0
+				[ -n "$rc_fast" ] && return 0
 				if [ -n "$pidfile" ]; then
 					echo \
 				    "${name} not running? (check $pidfile)."
 				else
 					echo "${name} not running?"
 				fi
-				exit 1
+				return 1
 			fi
 
 					# if the precmd failed and force
@@ -727,7 +727,7 @@
 				else
 					echo "${name} not running?"
 				fi
-				exit 1
+				return 1
 			fi
 			echo "Reloading ${name} config files."
 			if [ -n "$_precmd" ]; then
@@ -800,7 +800,7 @@
 
 	echo 1>&2 "$0: unknown directive '$rc_arg'."
 	rc_usage "$_keywords"
-	exit 1
+	return 1
 }
 
 #
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-rc/attachments/20040727/11dd4a6d/attachment.bin


More information about the freebsd-rc mailing list