Skip to content

Add default reload function#1032

Draft
funderscore1 wants to merge 4 commits into
OpenRC:masterfrom
funderscore1:default-reload
Draft

Add default reload function#1032
funderscore1 wants to merge 4 commits into
OpenRC:masterfrom
funderscore1:default-reload

Conversation

@funderscore1

@funderscore1 funderscore1 commented Jul 1, 2026

Copy link
Copy Markdown

Historically, reload was meant to be implemented by the service script. However in the end it seems most service scripts just send a signal by calling start-stop-daemon directly, something that can easily be done as a default and would reduce duplication.

Add default reload functions for both supervise-daemon and start-stop-daemon, which just send a signal to a service. The signal to send is configured by just setting:

reloadsig=USR1  # signal to send to trigger reload

For service scripts that need to do other things on reload, they can define their own reload function just like before.

@funderscore1 funderscore1 marked this pull request as draft July 1, 2026 16:56
Comment thread service-script-guide.md
reloadsig=HUP
```

For most daemons this is sufficient, though note it only works on OpenRC TODO.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be adjusted before merging

Comment thread sh/supervise-daemon.sh Outdated

local startchroot="$(service_get_value "chroot")"
local startpidfile="$(service_get_value "pidfile")"
chroot="${startchroot:-$chroot}"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

supervise-daemon pidfiles are neither stored in chroot, nor used for signal, sendsig uses an internal fifopath

Ferass El Hafidi added 4 commits July 3, 2026 19:12
In the past what has been recommended for having a way to reload a
daemon's configuration was to write a reload() function manually.
Over the years many openrc scripts in, for instance, Alpine aports
that have a reload() function are pretty much all the same (manually
using start-stop-daemon to send a signal).

Provide a default reload function that does exactly that. Those service
scripts now only have to define `reloadsig=` to the signal to be sent on
reload, for example `reloadsig=HUP`, and can drop their custom reload
function.

Signed-off-by: Ferass El Hafidi <funderscore@postmarketos.org>
…top}-daemon

Signed-off-by: Ferass El Hafidi <funderscore@postmarketos.org>
Signed-off-by: Ferass El Hafidi <funderscore@postmarketos.org>
Signed-off-by: Ferass El Hafidi <funderscore@postmarketos.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants