Created
March 27, 2018 16:49
-
-
Save tomfanning/585434ebd29bffdd88bf693d033fae19 to your computer and use it in GitHub Desktop.
Installing a console app as a service in systemctl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "[Unit] | |
Description=My Service Name | |
[Service] | |
WorkingDirectory=$workingdir | |
ExecStart=$workingdir/binary-name | |
Restart=always | |
RestartSec=10 # Restart service after 10 seconds if it crashes | |
SyslogIdentifier=myservicename | |
User=root | |
Environment=\"ASPNETCORE_ENVIRONMENT=Production\" | |
[Install] | |
WantedBy=multi-user.target" > /etc/systemd/system/myservicename.service | |
systemctl enable myservicename.service | |
systemctl start myservicename.service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment