nxhack / openwrt-node-packages

OpenWrt Project Node.js packages. v18.x TLS and v20.x LTS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add auto restart for zigbee2mqtt

Tao173 opened this issue · comments

commented

Sometimes Z2M stops working and needs to be restarted automatically, just like Docker's restart=always.
Adding procd_set_param respawn 3600 1 5 Or ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5} is useful. Is it possible to add it? I don't know how to merge it.
`#!/bin/sh /etc/rc.common

START=99
USE_PROCD=1

start_service()
{
procd_open_instance
procd_set_param env ZIGBEE2MQTT_DATA=/etc/zigbee2mqtt/ NODE_PATH=/opt/zigbee2mqtt/node_modules/winston/node_modules:/opt/zigbee2mqtt/node_modules/zigbee-herdsman/node_modules
procd_set_param command /usr/bin/npm start --prefix /opt/zigbee2mqtt
procd_set_param stdout 1
procd_set_param stderr 1
procd_set_param respawn 3600 1 5
procd_close_instance
}`