CP_EHRENAMT/deploy/backup-db.sh
2026-06-25 18:58:44 +02:00

18 lines
579 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
# Einfaches SQLite-Backup für CheckPoint Ehrenamt.
# Nutzt das Online-Backup (.backup) konsistent auch im laufenden Betrieb (WAL).
# Per Cron einmal täglich, siehe DEPLOY.md.
set -euo pipefail
DB="/opt/checkpoint/instance/checkpoint.sqlite"
ZIEL="/opt/checkpoint/backups"
AUFBEWAHRUNG_TAGE=14
mkdir -p "$ZIEL"
STAMP="$(date +%Y%m%d-%H%M%S)"
sqlite3 "$DB" ".backup '$ZIEL/checkpoint-$STAMP.sqlite'"
# Alte Backups aufräumen.
find "$ZIEL" -name 'checkpoint-*.sqlite' -mtime "+$AUFBEWAHRUNG_TAGE" -delete
echo "Backup: $ZIEL/checkpoint-$STAMP.sqlite"