notes-kanban/Barcode-Host/tasks/create-as-service.md
2024-06-03 07:25:11 -07:00

47 lines
993 B
Markdown

---
status: "4-Done"
type: "kanbn"
created: "2024-01-06T01:22:07.431Z"
updated: "2024-01-06T01:22:07.431Z"
---
# 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