Skip to content

Instantly share code, notes, and snippets.

@fastmover
Last active December 25, 2017 22:37
Show Gist options
  • Save fastmover/e8e41c761d2132ea240c542fe60bb780 to your computer and use it in GitHub Desktop.
Save fastmover/e8e41c761d2132ea240c542fe60bb780 to your computer and use it in GitHub Desktop.
For Ubuntu 16.04, create a new file in /etc/systemd/system/ with the name you'd like to use for this service. This is the name you'll be using for service `name` start/stop. Change line 10 to reflect the executable you're going to use. Then run `systemctl enable [service name]`. Then start the service: service [name] start
[Unit]
Description=Some Service
After=network.target
[Service]
Restart=always
Type=simple
User=root
ExecStart=/usr/local/bin/[binary-name]
#ExecStop=/usr/local/bin/[binary-name] stop
RemainAfterExit=true
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment