barcode-host/.kanbn/tasks/create-as-service.md
2023-06-03 19:05:08 -07:00

41 lines
888 B
Markdown

---
---
# Create as Service
```bash
sudo -i
echo >/etc/systemd/system/barcode-host.service && nano /etc/systemd/system/barcode-host.service
```
```conf
[Unit]
Description=Barcode Server
After=multi-user.target
[Service]
User=unity4
WorkingDirectory=/var/www/Barcode-Host/Server
ExecStart=/usr/local/bin/dotnet /var/www/Barcode-Host/Server/Barcode.Host.Server.dll
Restart=always
# Environment=ASPNETCORE_ENVIRONMENT=Development
# Environment=ASPNETCORE_ENVIRONMENT=Staging
Environment=ASPNETCORE_ENVIRONMENT=Production
[Install]
WantedBy=multi-user.target
```
```bash
systemctl daemon-reload
systemctl enable barcode-host.service
systemctl start barcode-host.service
systemctl status barcode-host.service
systemctl stop barcode-host.service
journalctl -fu barcode-host.service
journalctl --rotate
journalctl --vacuum-time=1s
```
## Sub-tasks
- [ ] phares3757
- [x] unity4
- [x] unity5