overthesun / simoc-sam

Live backend for SAM at Biosphere 2
2 stars 1 forks source link

Add a systemd unit file to run sensors as services #112

Closed ezio-melotti closed 3 months ago

ezio-melotti commented 3 months ago

This is an alternative solution to:

Instead of trying to launch tmux as a service, I created a unit file template that can be used to launch the individual sensor scripts as services, that can be enabled to automatically start on boot. The logs can be inspected using e.g. journalctl -u sensor-runner@scd30.service -f, so technically a tmux script that launches journalctl could be created to inspect multiple logs at once. This PR doesn't include this, and also doesn't include automation to (un)symlink this file. This can be added in a separate PR.

ezio-melotti commented 3 months ago

This PR doesn't include this, and also doesn't include automation to (un)symlink this file. This can be added in a separate PR.

The automation should:

sudo ln -s /home/pi/simoc-sam/configs/sensor-runner@.service /etc/systemd/system/sensor-runner@.service

sudo systemctl enable sensor-runner@scd30.service
sudo systemctl start sensor-runner@scd30.service

sudo systemctl enable sensor-runner@bme688.service
sudo systemctl start sensor-runner@bme688.service

A sudo systemctl daemon-reload might be needed after creating the symlink. To remove this, just stop/disable and remove the symlink.