feat(worker): Enhance db_worker script for better error handling and add systemd service example

This commit is contained in:
Ross
2026-05-17 21:36:46 +01:00
parent c2d8376e22
commit d77c5149f0
4 changed files with 130 additions and 91 deletions
+11 -1
View File
@@ -54,9 +54,19 @@ Manual worker startup (non-Docker production)
- To run it in the background and keep logs:
```sh
nohup DJANGO_SETTINGS_MODULE=rad.settings ./scripts/run-db-worker.sh > logs/db_worker.log 2>&1 &
nohup env DJANGO_SETTINGS_MODULE=rad.settings ./scripts/run-db-worker.sh > logs/db_worker.log 2>&1 &
```
- In fish shell, follow with `disown` so the shell does not keep the job attached:
```sh
nohup env DJANGO_SETTINGS_MODULE=rad.settings ./scripts/run-db-worker.sh > logs/db_worker.log 2>&1 &
disown
```
- For server reliability, prefer running the same script under `systemd` (auto-start on reboot, restart-on-failure).
- A starter unit file is provided at `scripts/db-worker.service.example`.
- To verify it is still running:
```sh