aboutsummaryrefslogtreecommitdiff
path: root/bup-vw-db.sh
blob: 904f09b58bd5bc0db9adeec1644665808cad715d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/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}"
bgstack15