From 5429717875bb50824fa83ae41d0c3a4b7bdd296b Mon Sep 17 00:00:00 2001 From: meow Date: Mon, 28 Sep 2026 02:31:16 +1200 Subject: [PATCH 1/6] Support 'reload' action for services with supervisor=supervise-daemon --- sh/openrc-run.sh.in | 1 + sh/supervise-daemon.sh | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/sh/openrc-run.sh.in b/sh/openrc-run.sh.in index d37774e25..61184c27f 100644 --- a/sh/openrc-run.sh.in +++ b/sh/openrc-run.sh.in @@ -207,6 +207,7 @@ default_reload() { case "$supervisor" in s6) s6_reload ;; + supervise-daemon) supervise_reload ;; ?*) eerror "$RC_SVCNAME: undefined function 'reload'" exit 1 diff --git a/sh/supervise-daemon.sh b/sh/supervise-daemon.sh index 331b8e908..81911a006 100644 --- a/sh/supervise-daemon.sh +++ b/sh/supervise-daemon.sh @@ -10,7 +10,7 @@ # This file may not be copied, modified, propagated, or distributed # except according to the terms contained in the LICENSE file. -extra_commands="healthcheck unhealthy ${extra_commands}" +extra_commands="healthcheck unhealthy reload ${extra_commands}" supervise_start() { @@ -83,6 +83,18 @@ supervise_stop() eend $? "Failed to stop ${name:-$RC_SVCNAME}" } +supervise_reload() +{ + local startchroot="$(service_get_value "chroot")" + local startpidfile="$(service_get_value "pidfile")" + chroot="${startchroot:-$chroot}" + pidfile="${startpidfile:-$pidfile}" + ebegin "Reloading ${name:-$RC_SVCNAME}" + supervise-daemon "${RC_SVCNAME}" --signal SIGHUP \ + ${pidfile:+--pidfile} $chroot$pidfile + eend $? "Failed to reload ${name:-$RC_SVCNAME}" +} + _check_supervised() { local child_pid start_time From a8b883abfd22edf53eba3a3cd6bdabbc42dc1848 Mon Sep 17 00:00:00 2001 From: meow Date: Mon, 28 Sep 2026 02:41:41 +1200 Subject: [PATCH 2/6] Document 'reload' action for s6 and supervise-daemon services --- man/openrc-run.8 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/man/openrc-run.8 b/man/openrc-run.8 index 470498199..b5dc9e8cf 100644 --- a/man/openrc-run.8 +++ b/man/openrc-run.8 @@ -51,6 +51,9 @@ Stops and starts the service, including dependencies. This cannot be overridden. See the description of the RC_CMD variable below for the method to make your service behave differently when restart is being executed. +.It Ar reload +Sends reload (SIGHUP) signal to the service, only supported when supervisor= is supervise-daemon +or s6. Note that this may kill daemons which do not process SIGHUP. .It Ar status Shows the status of the service. The return code matches the status, with the exception of "started" returning 0 to match standard command behaviour. From 44c59834ebebdfadab05a81a594e80afd9128415 Mon Sep 17 00:00:00 2001 From: meow Date: Mon, 28 Sep 2026 02:53:32 +1200 Subject: [PATCH 3/6] Document 'reload' action for s6 and supervise-daemon services [2] --- man/openrc-run.8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/man/openrc-run.8 b/man/openrc-run.8 index b5dc9e8cf..d981251f7 100644 --- a/man/openrc-run.8 +++ b/man/openrc-run.8 @@ -52,8 +52,8 @@ overridden. See the description of the RC_CMD variable below for the method to make your service behave differently when restart is being executed. .It Ar reload -Sends reload (SIGHUP) signal to the service, only supported when supervisor= is supervise-daemon -or s6. Note that this may kill daemons which do not process SIGHUP. +Sends reload (SIGHUP) signal to the service, only supported when supervisor is supervise-daemon +or s6. Note that this may kill daemons which do not process SIGHUP, supervise-daemon will restart them. .It Ar status Shows the status of the service. The return code matches the status, with the exception of "started" returning 0 to match standard command behaviour. From 543047429e69dc87fa4c21f8d261864252e4612c Mon Sep 17 00:00:00 2001 From: meow Date: Mon, 28 Sep 2026 03:25:22 +1200 Subject: [PATCH 4/6] Remove useless code from supervise-daemon's reload function --- sh/supervise-daemon.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/sh/supervise-daemon.sh b/sh/supervise-daemon.sh index 81911a006..35a0abc97 100644 --- a/sh/supervise-daemon.sh +++ b/sh/supervise-daemon.sh @@ -85,13 +85,8 @@ supervise_stop() supervise_reload() { - local startchroot="$(service_get_value "chroot")" - local startpidfile="$(service_get_value "pidfile")" - chroot="${startchroot:-$chroot}" - pidfile="${startpidfile:-$pidfile}" ebegin "Reloading ${name:-$RC_SVCNAME}" - supervise-daemon "${RC_SVCNAME}" --signal SIGHUP \ - ${pidfile:+--pidfile} $chroot$pidfile + supervise-daemon "${RC_SVCNAME}" --signal SIGHUP eend $? "Failed to reload ${name:-$RC_SVCNAME}" } From c30a1d6e16b1dc97bfc472c3b2d98eb8c216ec3c Mon Sep 17 00:00:00 2001 From: meow Date: Mon, 28 Sep 2026 03:49:47 +1200 Subject: [PATCH 5/6] Support reloadsig= option for supervise-daemon --- sh/supervise-daemon.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sh/supervise-daemon.sh b/sh/supervise-daemon.sh index 35a0abc97..f04a60e16 100644 --- a/sh/supervise-daemon.sh +++ b/sh/supervise-daemon.sh @@ -85,10 +85,15 @@ supervise_stop() supervise_reload() { - ebegin "Reloading ${name:-$RC_SVCNAME}" - supervise-daemon "${RC_SVCNAME}" --signal SIGHUP - eend $? "Failed to reload ${name:-$RC_SVCNAME}" -} + case "${reloadsig}" in + "") eerror "Reloading is disabled for ${name:-$RC_SVCNAME}" ;; + *) + ebegin "Reloading ${name:-$RC_SVCNAME}" + supervise-daemon "${RC_SVCNAME}" --signal "${reloadsig:-"HUP"}" + eend $? "Failed to reload ${name:-$RC_SVCNAME}" + ;; + esac +} _check_supervised() { From 874e8de3db30d69401120c0f177093c3b4d11c1d Mon Sep 17 00:00:00 2001 From: meow Date: Mon, 28 Sep 2026 03:55:24 +1200 Subject: [PATCH 6/6] Support reloadsig= option for supervise-daemon [2] --- sh/supervise-daemon.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sh/supervise-daemon.sh b/sh/supervise-daemon.sh index f04a60e16..4ea81d80b 100644 --- a/sh/supervise-daemon.sh +++ b/sh/supervise-daemon.sh @@ -93,7 +93,7 @@ supervise_reload() eend $? "Failed to reload ${name:-$RC_SVCNAME}" ;; esac -} +} _check_supervised() {