]> git.ipfire.org Git - thirdparty/chrony.git/commit
main: add support for systemd notification
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 5 Feb 2025 08:30:46 +0000 (09:30 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 5 Feb 2025 15:10:04 +0000 (16:10 +0100)
commitcb1118456b9fb1cbd3c953dbf970aa40d9dc1d29
tree9a72d980090a5163034c7a15ce7c0b45c9c653e4
parent8ee725ff188a8b4be9b060a02d8fcb3f38cf88fa
main: add support for systemd notification

On Linux, if the NOTIFY_SOCKET variable is set, send a "READY=1"
and "STOPPING=1" message to the Unix domain socket after initialization
and before finalization respectively. This is used with the systemd
"notify" service type as documented in the sd_notity(3) man page. It's
a recommended alternative to the "forking" service type, which does not
need the PID file to determine the main process.

Support pathname Unix sockets only. Abstract sockets don't seem to be
used by systemd for notifications since version 212.

Switch the example services to the notify type, but keep the PID
file. It's still useful to prevent start of other chronyd instances.
systemd doesn't seem to care about the content of the file and should
just remove it in case chronyd didn't terminate cleanly.

Suggested-by: Luca Boccassi <bluca@debian.org>
doc/chronyd.adoc
examples/chronyd-restricted.service
examples/chronyd.service
main.c