File size: 740 Bytes
0f32cbe
 
 
 
 
 
 
 
4466efd
 
 
0f32cbe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh
# 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