Created the required files to setup systemd units for autostart.
This commit is contained in:
20
systemd/dht-start-restart@.service
Normal file
20
systemd/dht-start-restart@.service
Normal file
@@ -0,0 +1,20 @@
|
||||
# Unit file template for creating auto start and restart of python script for dht sensor.
|
||||
# Template should be in /etc/systemd/system/dht-start-restart@.service
|
||||
# Environment Variables for each instances should be at /etc/default/dht-start-restart@%i
|
||||
# Enable with `systemctl enable --now remote-tunnel@%i`
|
||||
# where %i is the name of the pimonitoring instance (e.g. pimonitoring1)
|
||||
#
|
||||
[Unit]
|
||||
Description=Start python script for DHT22 sensor on %I
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=pi
|
||||
EnvironmentFile=/etc/default/dht-start-restart@%i
|
||||
ExecStart=/usr/bin/python3 ${PATH_TO_FILE}
|
||||
RestartSec=15
|
||||
Restart=always
|
||||
KillMode=mixed
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user