Spaces:
Running
Running
Download start-with-backup.sh from tkgray/Open-WebUI: direct link, hf CLI and curl.
- Browser
- Download file 740 Bytes
-
https://huggingface.co/spaces/tkgray/Open-WebUI/resolve/main/start-with-backup.sh
- Command line
-
hf download hf://spaces/tkgray/Open-WebUI/start-with-backup.sh
-
curl -L -o start-with-backup.sh https://huggingface.co/spaces/tkgray/Open-WebUI/resolve/main/start-with-backup.sh
740 Bytes
| # Startup wrapper: restore backup if needed, start periodic backup loop, then start Open WebUI. | |
| set -eu | |
| # 1. Restore if db doesn't exist | |
| /restore.sh | |
| # 2. Start background backup loop: hourly rolling snapshot (overwritten each run) | |
| # plus one dated snapshot per day, keeping the newest OWUI_BACKUP_DAILY_KEEP | |
| # (default 7) days. | |
| ( | |
| BACKUP_INTERVAL="${BACKUP_INTERVAL_SECONDS:-3600}" | |
| echo "[start] Backup loop started — interval: \${BACKUP_INTERVAL}s" | |
| while true; do | |
| sleep "$BACKUP_INTERVAL" | |
| /backup.sh | |
| done | |
| ) & | |
| # 3. Run initial backup after 60s (so the db exists after open-webui starts) | |
| ( | |
| sleep 60 | |
| /backup.sh | |
| ) & | |
| # 4. Start Open WebUI (exec so it becomes PID 1) | |
| exec ./start.sh | |