Daily SQLite backup script (VACUUM INTO, 7-day rotation)
Live user data had only a stale pre-migration backup. First snapshot verified: 9,837 questions, 6 users. Termux has no cron; script is manual or Tasker-driven.
This commit is contained in:
parent
cc0cd75ff9
commit
ad8e878af8
1 changed files with 11 additions and 0 deletions
11
deploy/termux-backup.sh
Executable file
11
deploy/termux-backup.sh
Executable file
|
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env bash
|
||||
# Daily SQLite backup: VACUUM INTO a timestamped copy, keep 7 days.
|
||||
# Usage: ./deploy/termux-backup.sh (run from repo root; safe while live)
|
||||
# Termux has no cron, so run this from Termux:Tasker, a daily alarm via
|
||||
# Termux:API, or manually. One line, one snapshot.
|
||||
cd "$(dirname "$0")/.."
|
||||
OUT="./backups/whaleprep-$(date +%F).db"
|
||||
mkdir -p ./backups
|
||||
sqlite3 ./whaleprep.db "VACUUM INTO '$OUT';"
|
||||
ls -t ./backups/whaleprep-*.db | tail -n +8 | xargs -r rm -f
|
||||
echo "backup -> $OUT ($(du -h "$OUT" | cut -f1))"
|
||||
Loading…
Add table
Reference in a new issue