Use the "--make-pidfile" when command_background is used

The start-stop-daemon "--make-pidfile" option is now used by default when using
command_background, this requires a pidfile to be specified.
Document command_background option.

Reported-by: Giampaolo Tomassoni <giampaolo@tomassoni.biz>
X-Gentoo-Bug: 399165
X-Gentoo-Bug-URL: https://bugs.gentoo.org/399165
This commit is contained in:
Christian Ruppert 2012-01-17 18:23:56 +01:00
parent d729f9d0f2
commit 9c0edc5c52
2 changed files with 10 additions and 1 deletions

View File

@ -111,6 +111,11 @@ Daemon to start or stop via
if no start or stop function is defined by the service. if no start or stop function is defined by the service.
.It Ar command_args .It Ar command_args
List of arguments to pass to the daemon when starting. 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 .It Ar pidfile
Pidfile to use for the above defined command. Pidfile to use for the above defined command.
.It Ar name .It Ar name

View File

@ -124,7 +124,11 @@ start()
local _background= local _background=
ebegin "Starting ${name:-$RC_SVCNAME}" ebegin "Starting ${name:-$RC_SVCNAME}"
if yesno "${command_background}"; then 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 fi
if yesno "$start_inactive"; then if yesno "$start_inactive"; then
local _inactive=false local _inactive=false