nixos/home-assistant: Restart systemd unit on restart service
Home-assistant through its `--runner` commandline flag supports sending exit code 100 when the `homeassistant.restart` service is called. With `RestartForceExitStatus` we can listen for that specific exit code and restart the whole systemd unit, providing an actual clean restart with fresh processes. Additional treat exit code 100 as a successful termination.
This commit is contained in:
parent
1dbb60f562
commit
f41349d30d
|
@ -267,11 +267,13 @@ in {
|
||||||
"CAP_NET_RAW"
|
"CAP_NET_RAW"
|
||||||
]));
|
]));
|
||||||
in {
|
in {
|
||||||
ExecStart = "${package}/bin/hass --config '${cfg.configDir}'";
|
ExecStart = "${package}/bin/hass --runner --config '${cfg.configDir}'";
|
||||||
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
|
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
|
||||||
User = "hass";
|
User = "hass";
|
||||||
Group = "hass";
|
Group = "hass";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
|
RestartForceExitStatus = "100";
|
||||||
|
SuccessExitStatus = "100";
|
||||||
KillSignal = "SIGINT";
|
KillSignal = "SIGINT";
|
||||||
|
|
||||||
# Hardening
|
# Hardening
|
||||||
|
|
Loading…
Reference in a new issue