diff --git a/man/runscript.8 b/man/runscript.8 index dbc0b7dc..dd934c4b 100644 --- a/man/runscript.8 +++ b/man/runscript.8 @@ -111,6 +111,11 @@ Daemon to start or stop via if no start or stop function is defined by the service. .It Ar command_args List of arguments to pass to the daemon when starting. +.It Ar command_background +Set this to "true", "yes" or "1" (case-insensitive) to force the daemon into +the background. This implies the "--make-pidfile" and "--pidfile" option of +.Xr start-stop-daemon 8 +so the pidfile variable must be set. .It Ar pidfile Pidfile to use for the above defined command. .It Ar name diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in index 470f04c6..e042be6d 100644 --- a/sh/runscript.sh.in +++ b/sh/runscript.sh.in @@ -124,7 +124,11 @@ start() local _background= ebegin "Starting ${name:-$RC_SVCNAME}" if yesno "${command_background}"; then - _background="--background --pidfile" + if [ -z "${pidfile}" ]; then + eend 1 "command_background option used but no pidfile specified" + return 1 + fi + _background="--background --make-pidfile --pidfile" fi if yesno "$start_inactive"; then local _inactive=false