-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdht22_homie.service
39 lines (28 loc) · 1005 Bytes
/
dht22_homie.service
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# systemd unit file for the Python DHT22 Service
[Unit]
# Human readable name of the unit
Description=DHT22 MQTT Homie Service
# Starting after System is online and docker is running
# Only needed if MQTT is used
#Wants=network-online.target
#After=network-online.target
#After=docker.service
#After=docker.socket
[Service]
# Command to execute when the service is started
ExecStart=/usr/bin/python3 /usr/local/sbin/dht22-homie.py
# Disable Python's buffering of STDOUT and STDERR, so that output from the
# service shows up immediately in systemd's logs
Environment=PYTHONUNBUFFERED=1
# Automatically restart the service if it crashes
Restart=on-failure
# Our service will notify systemd once it is up and running
Type=notify
# Use a dedicated user to run our service
User=root
# Send CTRL+C tot python Script to terminate it clean
KillSignal=SIGINT
[Install]
# Tell systemd to automatically start this service when the system boots
# (assuming the service is enabled)
WantedBy=default.target