From 3351c8b4c3027f09003f8ba33e43f46762f5c453 Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Thu, 19 May 2016 17:59:40 -0500 Subject: [PATCH] supervise-daemon.sh: add support for chroot variable --- sh/supervise-daemon.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sh/supervise-daemon.sh b/sh/supervise-daemon.sh index 34e3ef71..2d889a63 100644 --- a/sh/supervise-daemon.sh +++ b/sh/supervise-daemon.sh @@ -20,24 +20,30 @@ supervise_start() ebegin "Starting ${name:-$RC_SVCNAME}" eval supervise-daemon --start \ + ${chroot:+--chroot} $chroot \ ${pidfile:+--pidfile} $pidfile \ ${command_user+--user} $command_user \ $supervise_daemon_args \ $command \ -- $command_args $command_args_foreground 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" } supervise_stop() { + local startchroot="$(service_get_value "chroot")" local startpidfile="$(service_get_value "pidfile")" + chroot="${startchroot:-$chroot}" pidfile="${startpidfile:-$pidfile}" [ -n "$pidfile" ] || return 0 ebegin "Stopping ${name:-$RC_SVCNAME}" supervise-daemon --stop \ - ${pidfile:+--pidfile} $pidfile \ + ${pidfile:+--pidfile} $chroot$pidfile \ ${stopsig:+--signal} $stopsig eend $? "Failed to stop $RC_SVCNAME"