forked from DougBarnes/Factory_Modbus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpyController.service
41 lines (32 loc) · 1.34 KB
/
pyController.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
40
41
# https://www.freedesktop.org/software/systemd/man/systemd.service.html
# systemd unit file
[Unit]
# Human readable name of the unit. Updated in override file
Description=Mini-Factory 4.0 Controller
After=multi-user.target
[Service]
# Command to execute when the service is started. Added in override file
WorkingDirectory=/home/factory/Mini-Factory-Python-Controller
ExecStartPre=/usr/bin/git pull
ExecStart=/usr/bin/python3 /home/factory/Mini-Factory-Python-Controller/pyController/pyController.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
#Restart=no
RestartSec=5s # Time to sleep before restarting the service
TimeoutStopSec=20s
# "Units which are started more than burst times within an interval time interval are not permitted to start any more." ~systemd.unit doc
StartLimitInterval=1min
StartLimitBurst=10
StartLimitAction=none
# Use a dedicated user to run our service. Added in override file
User=factory
Group=factory
# Our service will notify systemd once it is up and running
Type=simple
#WatchdogSec=30s # for type notify services
[Install]
# Tell systemd to automatically start this service when the system boots when enabled
WantedBy=multi-user.target