|
#!/bin/sh
|
|
# File: vm4:/home/vaultwarden/bup-vw-db.sh
|
|
# Location: vm4
|
|
# Author: bgstack15
|
|
# Startdate: 2023-01-02-2 16:54
|
|
# Title: Bup Vaultwarden database
|
|
# Project: bup-vw
|
|
# Purpose: Backup Vaultwarden database
|
|
# History:
|
|
# Usage: called by bup-vw.sh
|
|
# Reference:
|
|
# https://github.com/dani-garcia/vaultwarden/wiki/General-%28not-docker%29
|
|
# https://stackoverflow.com/questions/25675314/how-to-backup-sqlite-database/25684912#25684912
|
|
# Improve:
|
|
# Dependencies:
|
|
# sqlite3
|
|
# must run as root!
|
|
# Documentation: see bup-vw.sh
|
|
INDB=/home/vaultwarden/vw/bitwarden/db.sqlite3
|
|
test -z "${LOCALOUTDIR}" && LOCALOUTDIR=/home/vaultwarden/bup
|
|
test -z "${OUTFILE}" && OUTFILE="${LOCALOUTDIR}/vw.$( date "+%F" ).sq3"
|
|
echo ".backup ${OUTFILE}" | sqlite3 "${INDB}"
|
|
# the main script will tarball it with the relevant files
|
|
#gzip "${OUTFILE}"
|
|
chown vaultwarden:vaultwarden "${OUTFILE}"
|
|
echo "${OUTFILE}"
|