3
0
Fork 0
forked from mirrors/nixpkgs

nixos/unifi: fix unifi ExecStop= being incompatible with systemd

unifi does not shut down properly when stopped via systemd (it always exits with
SIGTERM exit status) because systemd wants stop commands to not exit before the
main command is gone and unifi does not comply. the easiest way around this is
to have systemd send an ignored signal after the stop command has exited.

unifi may still throw exceptions during shutdown, but it *does* exit cleanly as
far as systemd is concerned now.
This commit is contained in:
pennae 2021-10-13 19:27:42 +02:00 committed by Kerstin
parent b53c5c4552
commit 300226261f

View file

@ -172,9 +172,15 @@ in
ExecStart = "${(removeSuffix "\n" cmd)} start";
ExecStop = "${(removeSuffix "\n" cmd)} stop";
Restart = "on-failure";
TimeoutSec = "5min";
User = "unifi";
UMask = "0077";
WorkingDirectory = "${stateDir}";
# the stop command exits while the main process is still running, and unifi
# wants to manage its own child processes. this means we have to set KillSignal
# to something the main process ignores, otherwise every stop will have unifi.service
# fail with SIGTERM status.
KillSignal = "SIGCONT";
# Hardening
AmbientCapabilities = "";