994 B
994 B
Creating systemd unit for Auto Start/Restart
The steps below outline the process for creating a systemd service unit.
This service will automatically start the python script.
Procedure
- Create the service template by copying
dht-start-restart@.serviceinto/etc/systemd/system/. - Define environment variables for an instance of this template by copying
dht-start-restart@pimonitoring1into/etc/default/.- NOTE: The instance should replace the name of the RPiZW. (e.g. pimonitoring2, etc.)
- Create the instance and enable it with
sudo systemctl enable --now dht-start-restart@pimonitoring1- NOTE: It may be required to reload the systemd daemon.
sudo systemctl reload-daemon
- NOTE: It may be required to reload the systemd daemon.
Common Issues
- Is the
User=indht-start-restart@.servicecorrect? pi vs. shaun - Is the
{PATH_TO_FILE}indht-start-restart@pimonitoring1correct?/home/pivs./home/shaun - Does the python script
main.pycontain any relative paths?