supervise-daemon.sh: add support for chroot variable
This commit is contained in:
parent
a8214af2fe
commit
3351c8b4c3
@ -20,24 +20,30 @@ supervise_start()
|
|||||||
|
|
||||||
ebegin "Starting ${name:-$RC_SVCNAME}"
|
ebegin "Starting ${name:-$RC_SVCNAME}"
|
||||||
eval supervise-daemon --start \
|
eval supervise-daemon --start \
|
||||||
|
${chroot:+--chroot} $chroot \
|
||||||
${pidfile:+--pidfile} $pidfile \
|
${pidfile:+--pidfile} $pidfile \
|
||||||
${command_user+--user} $command_user \
|
${command_user+--user} $command_user \
|
||||||
$supervise_daemon_args \
|
$supervise_daemon_args \
|
||||||
$command \
|
$command \
|
||||||
-- $command_args $command_args_foreground
|
-- $command_args $command_args_foreground
|
||||||
rc=$?
|
rc=$?
|
||||||
[ -n "${pidfile}" ] && service_set_value "pidfile" "${pidfile}"
|
if [ $rc = 0 ]; then
|
||||||
|
[ -n "${chroot}" ] && service_set_value "chroot" "${chroot}"
|
||||||
|
[ -n "${pidfile}" ] && service_set_value "pidfile" "${pidfile}"
|
||||||
|
fi
|
||||||
eend $rc "failed to start $RC_SVCNAME"
|
eend $rc "failed to start $RC_SVCNAME"
|
||||||
}
|
}
|
||||||
|
|
||||||
supervise_stop()
|
supervise_stop()
|
||||||
{
|
{
|
||||||
|
local startchroot="$(service_get_value "chroot")"
|
||||||
local startpidfile="$(service_get_value "pidfile")"
|
local startpidfile="$(service_get_value "pidfile")"
|
||||||
|
chroot="${startchroot:-$chroot}"
|
||||||
pidfile="${startpidfile:-$pidfile}"
|
pidfile="${startpidfile:-$pidfile}"
|
||||||
[ -n "$pidfile" ] || return 0
|
[ -n "$pidfile" ] || return 0
|
||||||
ebegin "Stopping ${name:-$RC_SVCNAME}"
|
ebegin "Stopping ${name:-$RC_SVCNAME}"
|
||||||
supervise-daemon --stop \
|
supervise-daemon --stop \
|
||||||
${pidfile:+--pidfile} $pidfile \
|
${pidfile:+--pidfile} $chroot$pidfile \
|
||||||
${stopsig:+--signal} $stopsig
|
${stopsig:+--signal} $stopsig
|
||||||
|
|
||||||
eend $? "Failed to stop $RC_SVCNAME"
|
eend $? "Failed to stop $RC_SVCNAME"
|
||||||
|
Loading…
Reference in New Issue
Block a user