backup-automation/vaultwarden/vaultwarden-backup.sh
ZoopaMario ba2987dbea
All checks were successful
Lint Bash Scripts / lint-bash (push) Successful in 27s
Refactor code base focusing on extendability
- Add a library file containing common logic to be sourced by individual backup scripts
- Integrate logger file as it so far only contained a single method
- Make sure all relevant variables are defined within the related .env file
- Remove the option to pass command line  arguments to the script
2024-12-30 08:59:56 +01:00

30 lines
711 B
Bash
Executable file

#!/bin/bash
SCRIPT_ABS_LOCATION=$(realpath "$(dirname "${0}")")
# shellcheck disable=SC1090
source "$SCRIPT_ABS_LOCATION/../common-backup.sh"
# shellcheck disable=SC1090
source "$SCRIPT_ABS_LOCATION/vaultwarden-backup.env"
# shellcheck disable=SC2034
LOG_FILE="$SCRIPT_ABS_LOCATION/vaultwarden-backup.log"
dump_sqlite_db "$SOURCE_DIR/db.sqlite3" "$SOURCE_DIR/$DB_TMP_BAK_NAME"
run_duplicati_backup \
"$BACKUP_DESTINATION" \
"vaultwarden" \
7 \
"$SFTP_USERNAME" \
"$SFTP_PASSWORD" \
"$SFTP_FINGERPRINT" \
"$BACKUP_ENCR_PASSPHRASE" \
"$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
}