summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Jacoutot <ajacoutot@cvs.openbsd.org>2011-03-06 16:49:49 +0000
committerAntoine Jacoutot <ajacoutot@cvs.openbsd.org>2011-03-06 16:49:49 +0000
commit6b182f2815fe18c634c9c1de0f3f5a67c166e4d0 (patch)
treef87bb7ecb2b1d7b8828c4b9bd589233d996e386c
parent8fcee31b845ae0f4dd57521addb372071b1bced3 (diff)
Add an "rc_bg" variable that is undefined by default and allows to start
a daemon in the background. man page tweaks from schwarze@ discussed with an ok schwarze@ robert@
-rw-r--r--etc/rc.d/rc.subr6
-rw-r--r--share/man/man8/rc.subr.820
2 files changed, 18 insertions, 8 deletions
diff --git a/etc/rc.d/rc.subr b/etc/rc.d/rc.subr
index 5032dfbc869..b236373e489 100644
--- a/etc/rc.d/rc.subr
+++ b/etc/rc.d/rc.subr
@@ -1,4 +1,4 @@
-# $OpenBSD: rc.subr,v 1.20 2011/02/24 07:07:03 ajacoutot Exp $
+# $OpenBSD: rc.subr,v 1.21 2011/03/06 16:49:48 ajacoutot Exp $
rc_err() {
echo $1
@@ -7,7 +7,7 @@ rc_err() {
rc_start() {
type rc_pre >/dev/null && rc_pre
- ${rcexec} "${daemon} ${daemon_flags}" >/dev/null
+ ${rcexec} "${daemon} ${daemon_flags} >/dev/null ${_bg}"
}
rc_check() {
@@ -30,6 +30,8 @@ rc_cmd() {
eval _enotsup=\${rc_${1}}
[ X"${_enotsup}" != X"NO" ] || rc_err "$0: $1 is not supported"
+ [ X"${rc_bg}" = X"YES" ] && local _bg="&"
+
case "$1" in
check)
rc_check
diff --git a/share/man/man8/rc.subr.8 b/share/man/man8/rc.subr.8
index ca2590bf19c..c392081268e 100644
--- a/share/man/man8/rc.subr.8
+++ b/share/man/man8/rc.subr.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: rc.subr.8,v 1.9 2011/03/05 12:56:33 schwarze Exp $
+.\" $OpenBSD: rc.subr.8,v 1.10 2011/03/06 16:49:47 ajacoutot Exp $
.\"
.\" Copyright (c) 2011 Robert Nagy, Antoine Jacoutot, Ingo Schwarze
.\" All rights reserved.
@@ -24,7 +24,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: March 5 2011 $
+.Dd $Mdocdate: March 6 2011 $
.Dt RC.SUBR 8
.Os
.Sh NAME
@@ -71,12 +71,13 @@ which defines default shell functions and variable values.
.It
Override the
.Va pexp
+variable or any of the
+.Ic rc_*
+functions and set the
+.Va rc_bg
or
.Va rc_reload
-variables
-or any of the
-.Ic rc_*
-functions, if needed.
+variables, if needed.
.It
Define an
.Ic rc_pre
@@ -208,6 +209,13 @@ script has to redefine this variable
.Em after
sourcing
.Nm .
+.It Va rc_bg
+Can be set to
+.Cm YES
+in an
+.Nm rc.d
+script to force starting the daemon in background when using the default
+.Fn rc_start .
.It Va rc_reload
Can be set to
.Cm NO