diff options
author | William Hubbs <w.d.hubbs@gmail.com> | 2016-05-19 17:59:40 -0500 |
---|---|---|
committer | William Hubbs <w.d.hubbs@gmail.com> | 2016-05-19 17:59:40 -0500 |
commit | 3351c8b4c3027f09003f8ba33e43f46762f5c453 (patch) | |
tree | 8fa7885cd0b4f9df1e96874335873d03066ca127 /sh | |
parent | a8214af2fe3aa91930e3270af99cf1d9b7ef5b0a (diff) |
supervise-daemon.sh: add support for chroot variable
Diffstat (limited to 'sh')
-rw-r--r-- | sh/supervise-daemon.sh | 10 |
1 files 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" |