4 ms·
Yes. I used to run my home automation stuff (Home Assistant, Node-RED, and a custom shim between my power meter interface and MQTT) in a FreeBSD Jail and recen
by Mister_Snuggles 6y ago
Yes.
I used to run my home automation stuff (Home Assistant, Node-RED, and a custom shim between my power meter interface and MQTT) in a FreeBSD Jail and recently switched to a Debian VM.
Getting everything to start properly with FreeBSD's rc scripts was a minor nightmare. It took a lot of work to accomplish the task of "Run command x, which doesn't daemonize, as user y in directory z and redirect stdout and stderr to blah.log". For quite a while, I was just running things by hand under tmux because I couldn't figure out the exact method to make it work properly.
In comparison, doing the same in systemd was incredibly easy. This type of service is really easy to set up in a systemd unit file.
I'll admit that a lot of the problems with doing this in FreeBSD were likely my own lack of skill and/or understanding. Systemd doesn't require this level of skill/understanding to set up a simple service though.
In terms of benefits of systemd, the best one for me is logging. Having stdout/stderr from these processes go to the journal automatically is quite nice and querying it with journalctl is easy now that I've figured out how to use it.
When developing simple services (like the custom shim mentioned earlier), systemd greatly simplifies things since I don't need to worry about daemonizing, switching users, logging, etc.
- fanf2 6y agoIsn't that one command on FreeBSD? chdir z && daemon -u y -o blah.log x https://www.freebsd.org/cgi/man.cgi?query=daemon https://www.freebsd.org/cgi/man.cgi?query=daemon
- Mister_Snuggles 6y agoI seem to remember having problems with daemon, but I can't remember what they were exactly. The Jail is gone now, so I can't look at the end result to see what I ended up with. By all accounts, this command should do exactly what I need though. I probably ended up with something like this[0], which doesn't use daemon. Home Assistant also provides a FreeNAS example[1] which uses daemon. For comparison, the systemd unit file that I ended up with is: [Unit] Description=Home Assistant After=network.target [Service] Type=simple Restart=always ExecStart=/home/hass/homeassistant/bin/python /home/hass/homeassistant/bin/hass WorkingDirectory=/home/hass User=hass Group=hass [Install] WantedBy=multi-user.target [0] https://gist.github.com/damoun/96add58f60572cb12c11 https://gist.github.com/damoun/96add58f60572cb12c11 [1] https://www.home-assistant.io/docs/installation/freenas/ https://www.home-assistant.io/docs/installation/freenas/