Skip to content

Instantly share code, notes, and snippets.

@isaacgr
Created June 2, 2019 22:13
Show Gist options
  • Save isaacgr/163db142e89df6212686f8fe91d5bde6 to your computer and use it in GitHub Desktop.
Save isaacgr/163db142e89df6212686f8fe91d5bde6 to your computer and use it in GitHub Desktop.
Systemd service file. Includes environment variables and logging.
[Unit]
Description=Web Client Service
After=multi-user.target
[email protected]
[Service]
Type=simple
# optional environment variable location which will be converted to variables readable by this file
# in this case $FLAGS
EnvironmentFile=/etc/default/webclient
ExecStart=/usr/bin/python /usr/local/bin/client/main.py $FLAGS
StandardInput=tty-force
# comment out the standard output or error if script includes logging to a file already
StandardOutput=file:/var/log/webclient.log
StandardError=file:/var/log/webclient.log
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment