ZoopaMario
2096e5b95e
Add a library file containing common logic to be sourced by individual backup scripts
39 lines
938 B
Bash
Executable file
39 lines
938 B
Bash
Executable file
#!/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
|
|
}
|
|
|