Skip to content

Instantly share code, notes, and snippets.

@machiel
Last active November 6, 2017 13:18
Show Gist options
  • Save machiel/9e8ae2cc300a8f29f7a2df23f142a902 to your computer and use it in GitHub Desktop.
Save machiel/9e8ae2cc300a8f29f7a2df23f142a902 to your computer and use it in GitHub Desktop.
systemctl golang service
#/lib/systemd/system/myservice.service
[Unit]
Description=Service
ConditionPathExists=/path/to/web/folder
[Service]
User=myuser # make sure to do run $ loginctl enable-linger myuser
Group=mygroup
Restart=always
RestartSec=3
WorkingDirectory=/path/to/web/folder
ExecStart=/path/to/web/folder/executable
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment