tkgray commited on
Commit
0f32cbe
·
verified ·
1 Parent(s): e993114

Upload start-with-backup.sh with huggingface_hub

Browse files
Files changed (1) hide show
  1. start-with-backup.sh +26 -0
start-with-backup.sh ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ # Startup wrapper: restore backup if needed, start periodic backup loop, then start Open WebUI.
3
+
4
+ set -eu
5
+
6
+ # 1. Restore if db doesn't exist
7
+ /restore.sh
8
+
9
+ # 2. Start background backup loop (every hour, keeps last 24 snapshots)
10
+ (
11
+ BACKUP_INTERVAL="${BACKUP_INTERVAL_SECONDS:-3600}"
12
+ echo "[start] Backup loop started — interval: \${BACKUP_INTERVAL}s"
13
+ while true; do
14
+ sleep "$BACKUP_INTERVAL"
15
+ /backup.sh
16
+ done
17
+ ) &
18
+
19
+ # 3. Run initial backup after 60s (so the db exists after open-webui starts)
20
+ (
21
+ sleep 60
22
+ /backup.sh
23
+ ) &
24
+
25
+ # 4. Start Open WebUI (exec so it becomes PID 1)
26
+ exec ./start.sh