Draft: Use sd_notify to notify systemd of completion of initialization
This uses the PyPI sdnotify package to implement notification of initialization via the systemd notify protocol. This resolves the FAQ about the "PID file not found" warning often seen in systemctl status. Other than explicit notification, the initialization process is not changed.
If this MR is merged, the documentation MR mailman-suite-doc!183 (changing Service Type in the example mailman3.service) should also be merged.
The sdnotify package has three important characteristics:
- Pure-Python implementation
- Talks directly to systemd's socket (no other dependencies pulled in)
- Ignores the error if the socket is not available (thus can be used by default even on systems without systemd)
Two alternative implementations were considered:
- Copy the sdnotify code directly into the cli_control module. Seems unfair to the developer, though.
- Use the systemd-python package from the systemd developers. But this would only be a big win if we wanted to use additional features (such as systemd.journal or more daemon control features) from the library, which I think are unclear. It will not be hard to substitute the systemd.daemon package for sdnotify if desired later.
Edited by Stephen J. Turnbull