nano /etc/systemd/system/MyService.service
systemctl enable MyService.service
systemctl start MyService.service
systemctl stop MyService.service
systemctl status MyService.service
nano /etc/systemd/system/MyService.service
systemctl enable MyService.service
systemctl start MyService.service
systemctl stop MyService.service
systemctl status MyService.service
| [Unit] | |
| Description=MyService Description | |
| [Service] | |
| WorkingDirectory=/path/to/app/ | |
| ExecStart=/usr/bin/dotnet /path/to/app/App.dll | |
| Restart=always | |
| # Restart service after 10 seconds if the dotnet service crashes: | |
| RestartSec=10 | |
| KillSignal=SIGINT | |
| SyslogIdentifier=log.antoniocampos | |
| User=www-data | |
| Environment=ASPNETCORE_ENVIRONMENT=Production | |
| TimeoutStopSec=30 | |
| [Install] | |
| WantedBy=multi-user.target |