I need to take a backup of an SQLite3 DB matching the state of other applications writing to disk, besides a vault using the filesystem as a backend.
I need to do this in a system with no ZFS so no snapshots could be taken.
Currently trying a basic script with something like this:
DAY=$(date +%d)
TDIR=$(mktemp -d)
cleanup() {
test -n "${TDIR}" && test -d "${TDIR}" && rm -rf "${TDIR}"
}
trap cleanup EXIT
# define and create the working directory
WRKDIR="${TDIR}/${DAY}"
mkdir "${WRKDIR}"
# take dump of the sqlite db
sqlite3 /data/data/test.db ".backup '${WRKDIR}/test.db'"
# backup the vault keys
cp -R /data/vault/ ${WRKDIR}/vault
# backup logs
cp -R /data/logs/ ${WRKDIR}/logs
0 Answers