diff --git a/man/openrc-run.8 b/man/openrc-run.8 index 470498199..d981251f7 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, 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. 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..4ea81d80b 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() +{ + 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() { local child_pid start_time