summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-devel@skarnet.org>2026-01-05 15:42:15 +0100
committerAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2026-01-07 11:36:10 +0100
commit41432afc408b07fa7aff99943ce842f60d3a46eb (patch)
tree84513ae32635b9ae0485aa2dbb7c1baeceabb529
parenta951b9a2161251c19abaf370893ec3785d31a3da (diff)
Remove restart(); add framework for reload() supportorigin/s6-reload
OpenRC will never call restart(), so scrap the definition in openrc-run.sh and s6.sh. reload() caused a weird error message when used without supervisor=s6, so add proper support for generic reload(), instantiated for s6, and with a better default error message for other backends - which can now add support for reload() down the line. Also clarify a comment, and add info messages on s6_reload.
-rw-r--r--sh/openrc-run.sh.in16
-rw-r--r--sh/s6.sh11
2 files changed, 20 insertions, 7 deletions
diff --git a/sh/openrc-run.sh.in b/sh/openrc-run.sh.in
index af64024c..3b3adb8e 100644
--- a/sh/openrc-run.sh.in
+++ b/sh/openrc-run.sh.in
@@ -203,6 +203,17 @@ default_status()
$func
}
+default_reload()
+{
+ case "$supervisor" in
+ s6) s6_reload ;;
+ ?*)
+ eerror "$RC_SVCNAME: undefined function 'reload'"
+ exit 1
+ ;;
+ esac
+}
+
# Template start / stop / status functions
# package init scripts may override these, but the bodies are as minimal as
# possible, so that the init scripts can creatively wrap default_*
@@ -222,6 +233,11 @@ status()
default_status
}
+reload()
+{
+ default_reload
+}
+
# Start debug output
yesno $RC_DEBUG && set -x
diff --git a/sh/s6.sh b/sh/s6.sh
index dc8d003a..7117ba32 100644
--- a/sh/s6.sh
+++ b/sh/s6.sh
@@ -115,7 +115,7 @@ _s6_servicedir_create() {
fi
{
- # We use execline here because it makes code generation easier.
+ # Generating execline code here because it is much easier than generating sh.
# The command will still be interpreted by sh in the end.
echo "#!$_execlineb -S1"
if test -n "$umask" ; then
@@ -222,12 +222,9 @@ s6_status() {
fi
}
-restart() {
- _s6_set_variables
- s6-svc -r -- "$_service"
-}
-
-reload() {
+s6_reload() {
_s6_set_variables
+ ebegin "Reloading $name"
s6-svc -h -- "$_service"
+ eend $? "s6-svc -h command failed"
}