Zigbee2MQTT in iocage service creation

DustinThal

Cadet
Joined
Sep 23, 2020
Messages
4
Hi,

first off all, I am new to FreeNAS and FreeBSD but i work with debian for years.

I already sucessfully installed Zigbee2Mqtt in an iocage with zigbee stick. all working fine if i start it by hand.

Now i am trying to get it as a service and that freaks me out.

First of all my file from /user/local/etc/rc.d/:

Code:
#!/bin/sh

. /etc/rc.subr

name=zigbee2mqtt
rcvar=zigbee2mqtt_enable

command=/usr/local/bin/npm
command_args=" start --prefix /opt/zigbee2mqtt/"

load_rc_config $name
run_rc_command "$1"


if i try to start it with service zigbee2mqtt onestart it fails with:

Code:
Starting zigbee2mqtt.
env: node: No such file or directory
/usr/local/etc/rc.d/zigbee2mqtt: WARNING: failed to start zigbee2mqtt


But (and that is what i don't understand) if i start it with /usr/local/etc/rc.d/zigbee2mqtt onestart it works.

Hopefully some can give me a hint that i figure it out myself, but at the moment im stuck.

BR Dustin
 

DustinThal

Cadet
Joined
Sep 23, 2020
Messages
4
Hi,

first off all, I am new to FreeNAS and FreeBSD but i work with debian for years.

I already sucessfully installed Zigbee2Mqtt in an iocage with zigbee stick. all working fine if i start it by hand.

Now i am trying to get it as a service and that freaks me out.

First of all my file from /user/local/etc/rc.d/:

Code:
#!/bin/sh

. /etc/rc.subr

name=zigbee2mqtt
rcvar=zigbee2mqtt_enable

command=/usr/local/bin/npm
command_args=" start --prefix /opt/zigbee2mqtt/"

load_rc_config $name
run_rc_command "$1"


if i try to start it with service zigbee2mqtt onestart it fails with:

Code:
Starting zigbee2mqtt.
env: node: No such file or directory
/usr/local/etc/rc.d/zigbee2mqtt: WARNING: failed to start zigbee2mqtt


But (and that is what i don't understand) if i start it with /usr/local/etc/rc.d/zigbee2mqtt onestart it works.

Hopefully some can give me a hint that i figure it out myself, but at the moment im stuck.

BR Dustin
Solution: use pm2
 
Top