From 31c73e696f281c99d422891dec86b6d0597f89f1 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Sun, 21 Aug 2022 22:25:12 -0500 Subject: [PATCH] r/z*2mqtt: Restart services after unexpected stop Both *zwavejs2mqtt* and *zigbee2mqtt* have various bugs that can cause them to crash in the face of errors that should be recoverable. Specifically, when there are network errors, the processes do not always handle these well. Especially during first startup, they tend to crash instead of retry. Thus, we'll move the retry logic into systemd. --- roles/zigbee2mqtt/templates/zigbee2mqtt.service.j2 | 1 + roles/zwavejs2mqtt/templates/zwavejs2mqtt.service.j2 | 1 + 2 files changed, 2 insertions(+) diff --git a/roles/zigbee2mqtt/templates/zigbee2mqtt.service.j2 b/roles/zigbee2mqtt/templates/zigbee2mqtt.service.j2 index 8f0a7aa..6b0557e 100644 --- a/roles/zigbee2mqtt/templates/zigbee2mqtt.service.j2 +++ b/roles/zigbee2mqtt/templates/zigbee2mqtt.service.j2 @@ -24,6 +24,7 @@ ExecStart=/usr/bin/podman run \ --gidmap 1:5100001:1024 \ --device {{ zigbee2mqtt_device }}:{{ zigbee2mqtt_container_device }}:rw \ docker.io/koenkk/zigbee2mqtt:latest +Restart=always ProtectSystem=full UMask=0077 TimeoutStartSec=5min diff --git a/roles/zwavejs2mqtt/templates/zwavejs2mqtt.service.j2 b/roles/zwavejs2mqtt/templates/zwavejs2mqtt.service.j2 index 9024408..4a8596f 100644 --- a/roles/zwavejs2mqtt/templates/zwavejs2mqtt.service.j2 +++ b/roles/zwavejs2mqtt/templates/zwavejs2mqtt.service.j2 @@ -24,6 +24,7 @@ ExecStart=/usr/bin/podman run \ --gidmap 1:5000001:1024 \ --device {{ zwavejs_device }}:{{ zwavejs_device_container}}:rw \ docker.io/zwavejs/zwavejs2mqtt:latest +Restart=always ProtectSystem=full UMask=0077 TimeoutStartSec=5min