Running as a service in FreeBSD

Probably it is a quite dumb question, but someone could give me the directions to run zigbee2mqtt as a service on freeBSD?

I installed it in a jail because I have a NAS with Freenas OS, and all is running without problems, but zigbee2mqtt stops workings as soon I close the shell. As I use Freenas mostly by the GUI and rarely deal with command line, I can’t accomplish the instructions of the “Running zigbee2mqtt”, topic 5 "5. (Optional) Running as a daemon with systemctl ", as it was written for Linux.

After some research I’m guessing that the script needs to be at “/usr/local/etc/rc.d” but trying to run it with “service zigbee2mqtt start” gives me “[Unit] not found” “[Service] not found” etc.
Probably it’s very simple for those who know how to write a script in FreeBSD.

Thank you

Did you get this working? I’m just trying to do the same?

No, I gave up. I always keep the shell opened.
Another problem is that every time I restart the server, Freenas assigns another address to CC2531 like CUA0 or CUA1 forcing me to change the configuration.

I think you can run docker in FreeNas can’t you? Can you run Zigbee2Mqtt in Docker on FreeNas? You can then set the restart option of the container to something like unless-stopped which should keep it up and running even after a reboot.

I have little knowledge about Docker but researching about it in Freenas community people say that it was present in the past version 10.0, but as a Linux VM. So probably going this way would make less sense than creating a dedicated Linux VM to run and zigbee2mqtt (as currently I’m running HASS Core in a FreeBSD’s jail)