Legg til en fil i /etc/systemd/system/xxx.service
[Unit]
Description=xxx app for xxx
[Service]
WorkingDirectory=/opt/xxx/published/
ExecStart=/usr/bin/dotnet /opt/xxx/published/Teller.dll --urls "http://*:5100"
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=XxxApp
User=xxxuserxxx
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
[Install]
WantedBy=multi-user.target
Kjør kommano systemctl start xxx for å starte tjenesten
Kjør kommando sudo systemctl xxx enable for å starte tjenesten automatisk ved reboot