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