#!/bin/bash # Consistent SQLite snapshot of the arbo gallery DB, run before the restic backup. # Uses SQLite's online-backup API (safe under concurrent writes) to write # gallery.sqlite.bak INSIDE the arbo_db volume — which is already a restic # source (/var/lib/docker/volumes), so the consistent copy rides the daily run. # NON-FATAL by design: a failure here (e.g. container down) must NOT abort the # host's sole backup, hence the trailing `|| true`. docker exec arbo python -c 'import sqlite3; s=sqlite3.connect("/data/gallery.sqlite"); d=sqlite3.connect("/data/gallery.sqlite.bak"); s.backup(d); d.close(); s.close()' || true