#!/bin/bash SCRIPT_ABS_LOCATION=$(realpath "$(dirname "${0}")") # shellcheck disable=SC1090 source "$SCRIPT_ABS_LOCATION/vaultwarden-backup.env"; \ # shellcheck disable=SC1090 source "$SCRIPT_ABS_LOCATION/../logger.sh"; \ # shellcheck disable=SC1090 source "$SCRIPT_ABS_LOCATION/../common-backup.sh" # shellcheck disable=SC2034 LOG_FILE="$SCRIPT_ABS_LOCATION/vaultwarden-backup.log" BACKUP_CONTAINER="duplicati" SOURCE_DIR="/mnt/data/vaultwarden" DB_TMP_BAK_NAME="vaultwarden-db_$(date +"%Y%m%d").sqlite3" dump_sqlite_db "$SOURCE_DIR/db.sqlite3" "$SOURCE_DIR/$DB_TMP_BAK_NAME" run_duplicati_backup \ "$BACKUP_CONTAINER" \ "$BACKUP_DESTINATION" \ "vaultwarden" \ 7 \ "$SFTP_USERNAME" \ "$SFTP_PASSWORD" \ "$BACKUP_ENCR_PASSPHRASE" \ "$SFTP_FINGERPRINT" \ "$SOURCE_DIR" log "Deleting vaultwarden temp DB backup..." rm "$SOURCE_DIR/$DB_TMP_BAK_NAME" || { log "Error: Failed to delete temp DB backup." exit 1 }