Rsync Snapshot Backup
Mirror a directory to a backup target with dry-run, delete protection, and a log.
$ webtoolist --script safe-sqlite-backup
Use SQLite's online backup API to copy a live database consistently.
sqlitebackupdatabaseintegrityDependencies: sqlite3
#!/usr/bin/env bash
set -euo pipefail
db="${1:-}"
out_dir="${2:-}"
[[ -f "$db" && -n "$out_dir" ]] || { echo "usage: $0 DB_PATH OUT_DIR" >&2; exit 1; }
command -v sqlite3 >/dev/null || { echo "sqlite3 not found" >&2; exit 1; }
mkdir -p "$out_dir"
stamp="$(date +%Y%m%d-%H%M%S)"
target="$out_dir/$(basename "$db").$stamp"
sqlite3 "$db" ".backup '$target'"
result="$(sqlite3 "$target" 'PRAGMA integrity_check;')"
if [[ "$result" == ok ]]; then
echo "backup ok: $target"
else
echo "integrity check failed: $result" >&2
exit 1
fi
./safe-sqlite-backup ./app.db /mnt/backups/sqlite
.backup already includes committed data.Related scripts
Mirror a directory to a backup target with dry-run, delete protection, and a log.
Create a compressed, timestamped tar archive of a directory and verify it.
Check an archive's checksum, list its contents, and compare a sample safely.