-
Notifications
You must be signed in to change notification settings - Fork 2
/
diyac.service_example
49 lines (38 loc) · 1.17 KB
/
diyac.service_example
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
40
41
42
43
44
45
46
47
48
49
[Unit]
# Human readable name of the unit
Description=diyac
# We need gpiod to be started before attempting to run
Requires=pigpiod
After=pigpiod
[Service]
# Command to execute when the service is started
ExecStart=/usr/bin/python3 /home/pi/DIYAC/main.py
# Command to reload the allowedTokens file
ExecReload=/bin/kill -HUP $MAINPID
# Command for stopping
ExecStop=/bin/kill -TERM $MAINPID
# Disable Python's buffering of STDOUT and STDERR, so that output from the
# service shows up immediately in systemd's logs
Environment=PYTHONUNBUFFERED=1
# make sure the program can know if it's started by systemd
Environment=LAUNCHED_BY_SYSTEMD=1
# Timeouts and watchdog
TimeoutStartSec=5
TimeoutStopSec=5
WatchdogSec=12
WatchdogSignal=SIGINT
# Automatically restart the service if it crashes
Restart=on-failure
# limit to only 1 retry attempt, with 1 second wait
StartLimitBurst=3
StartLimitIntervalSec=8
RestartSec=2
# Our service will notify systemd once it is up and running
Type=notify
NotifyAccess=all
# Use a dedicated user to run our service
User=pi
[Install]
# Tell systemd to automatically start this service when the system boots
# (assuming the service is enabled)
WantedBy=default.target