roles/python_stuff/templates/python.service.j2 (view raw)
1[Unit]
2Description=A Python project.
3After=syslog.target network.target
4
5[Service]
6Type=simple
7Restart=on-failure
8StartLimitBurst=2
9# Restart, but not more than once every x seconds: 30=30s, 600=10m
10StartLimitInterval=30
11WorkingDirectory={{ repo_dir }}{{ item }}
12ExecStart={{ repo_dir }}{{ item }}/venv/bin/python {{ repo_dir }}{{ item }}/main.py
13User={{ user }}
14StandardOutput=syslog
15StandardError=syslog
16SyslogIdentifier= {{ item }}
17
18[Install]
19WantedBy=multi-user.target