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.
34 lines
937 B
Django/Jinja
34 lines
937 B
Django/Jinja
[Unit]
|
|
Description=Zwavejs2Mqtt
|
|
After=network-online.target
|
|
After=time-sync.target
|
|
Wants=network-online.target
|
|
Wants=time-sync.target
|
|
|
|
[Service]
|
|
Type=notify
|
|
NotifyAccess=all
|
|
ExecStartPre=/usr/bin/setfacl -m zwavejs:rw {{ zwavejs_device }}
|
|
ExecStartPre=/usr/bin/chcon -t console_device_t {{ zwavejs_device }}
|
|
ExecStartPre=-/usr/bin/podman container rm --ignore -f zwavejs2mqtt
|
|
ExecStart=/usr/bin/podman run \
|
|
--pull never \
|
|
--sdnotify=conmon --cgroups=no-conmon \
|
|
--rm \
|
|
--network=host \
|
|
--name zwavejs2mqtt \
|
|
-v /var/lib/zwavejs:/usr/src/app/store:Z \
|
|
--uidmap 0:{{ zwavejs_user.uid }}:1 \
|
|
--gidmap 0:{{ zwavejs_user.group }}:1 \
|
|
--uidmap 1:5000001:1024 \
|
|
--gidmap 1:5000001:1024 \
|
|
--device {{ zwavejs_device }}:{{ zwavejs_device_container}}:rw \
|
|
docker.io/zwavejs/zwavejs2mqtt:latest
|
|
Restart=always
|
|
ProtectSystem=full
|
|
UMask=0077
|
|
TimeoutStartSec=5min
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|