Refactor code to make linter runs succeed
Some checks failed
Lint Bash Scripts / lint-bash (push) Failing after 27s
Check Commit Messages / check-commit-message (pull_request) Successful in 14s
Lint Bash Scripts / lint-bash (pull_request) Failing after 24s

This commit refactors the codebase in order to make the shellcheck
workflow pass.
This commit is contained in:
ZoopaMario 2024-12-29 15:08:09 +01:00
parent 6a4d145ac7
commit 0e985dc381
9 changed files with 145 additions and 158 deletions

View file

@ -18,14 +18,34 @@ jobs:
- name: Checkout Code
uses: https://code.forgejo.org/actions/checkout@v4
with:
fetch-depth: 0 # Fetch the entire history to avoid REST API reliance
fetch-depth: 0
- name: Install ShellCheck
run: |
apt-get update && apt-get install -y shellcheck
- name: Lint Bash Scripts
- name: Find Shell Scripts
id: find-scripts
run: |
echo "Linting Bash scripts..."
find . -name '*.sh' -print0 | xargs -0 shellcheck
echo "Searching for shell scripts..."
find . -name '*.sh' > shell-scripts.list
echo "Found the following scripts:"
cat shell-scripts.list
- name: Run ShellCheck in Script Directories
shell: bash
run: |
echo "Running ShellCheck in each script's directory..."
if [ ! -s shell-scripts.list ]; then
echo "No shell scripts found."
exit 0
fi
while IFS= read -r script; do
echo "Checking $script"
script_dir=$(dirname "$script")
script_name=$(basename "$script")
# Change to the script's directory and run ShellCheck
(cd "$script_dir" && shellcheck -x "$script_name")
done < shell-scripts.list

View file

@ -1,25 +1,21 @@
#!/bin/bash
SCRIPT_ABS_LOCATION=$(realpath "$(dirname "${0}")")
source $SCRIPT_ABS_LOCATION/cryptpad-backup.env
source $SCRIPT_ABS_LOCATION/../logger.sh
# shellcheck disable=SC1090
source "$SCRIPT_ABS_LOCATION/cryptpad-backup.env"
# shellcheck disable=SC1090
source "$SCRIPT_ABS_LOCATION/../logger.sh"
# Container Names
CONTAINER="cryptpad"
BACKUP_CONTAINER="duplicati"
SOURCE_DIR="/mnt/data/cryptpad"
BACKUP_DESTINATION="$BACKUP_DESTINATION"
BACKUP_ENCR_PASSPHRASE="$BACKUP_ENCR_PASSPHRASE"
# Cloud Storage Authentication
SFTP_USERNAME="$SFTP_USERNAME"
SFTP_PASSWORD="$SFTP_PASSWORD"
SFTP_FINGERPRINT="$SFTP_FINGERPRINT"
# Log file
LOG_FILE="$SCRIPT_ABS_LOCATION/cryptpad-backup.log"
SOURCE_DIR="/mnt/data/cryptpad"
# Cleanup inactive and archive files
log "Cleaning up inactive accounts and files to save space..."
docker exec cryptpad \
@ -33,20 +29,20 @@ docker exec cryptpad \
# Backup all files to target destination
log "Backing up cryptpad files and database..."
docker exec $BACKUP_CONTAINER \
duplicati-cli backup ssh://$BACKUP_DESTINATION \
$SOURCE_DIR/data \
$SOURCE_DIR/datastore \
$SOURCE_DIR/block \
$SOURCE_DIR/blob \
$SOURCE_DIR/config/config.js \
$SOURCE_DIR/customize \
$SOURCE_DIR/customize.dist \
docker exec "$BACKUP_CONTAINER" \
duplicati-cli backup "ssh://$BACKUP_DESTINATION" \
"$SOURCE_DIR/data" \
"$SOURCE_DIR/datastore" \
"$SOURCE_DIR/block" \
"$SOURCE_DIR/blob" \
"$SOURCE_DIR/config/config.js" \
"$SOURCE_DIR/customize" \
"$SOURCE_DIR/customize.dist" \
--backup-name="$CONTAINER backup" \
--keep-versions=7 \
--auth-username=$SFTP_USERNAME \
--auth-password=$SFTP_PASSWORD \
--passphrase=$BACKUP_ENCR_PASSPHRASE \
--auth-username="$SFTP_USERNAME" \
--auth-password="$SFTP_PASSWORD" \
--passphrase="$BACKUP_ENCR_PASSPHRASE" \
--ssh-fingerprint="$SFTP_FINGERPRINT" \
--prefix="cryptpad" || { log "Error: Failed to backup cryptpad files and database."; exit 1; }
log "cryptpad backup completed successfully."

View file

@ -1,29 +1,20 @@
#!/bin/bash
SCRIPT_ABS_LOCATION=$(realpath "$(dirname "${0}")")
source $SCRIPT_ABS_LOCATION/duplicati-backup.env
source $SCRIPT_ABS_LOCATION/../logger.sh
# shellcheck disable=SC1090
source "$SCRIPT_ABS_LOCATION/duplicati-backup.env"
# Container Name
CONTAINER="duplicati"
# shellcheck disable=SC1090
source "$SCRIPT_ABS_LOCATION/../logger.sh"
# Default values
SOURCE_DIR="/mnt/data/duplicati"
SSH_DESTINATION="$SSH_DESTINATION"
BACKUP_ENCR_PASSPHRASE="$BACKUP_ENCR_PASSPHRASE"
# Cloud Storage Authentication
SSH_USERNAME="$SSH_USERNAME"
SSH_PASSWORD="$SSH_PASSWORD"
SSH_KEY="$SSH_KEY"
# Set default values for parameters
MAX_BACKUPS=7
BACKUP_FOLDER=""
# Log file
SSH_KEY="${SSH_KEY:-$HOME/.ssh/id_rsa}"
LOG_FILE="$SCRIPT_ABS_LOCATION/duplicati-backup.log"
# Override default values with command-line arguments
# Override with command-line arguments
while getopts ":f:h:u:p:m:b:" opt; do
case $opt in
f) SOURCE_DIR="$OPTARG";;
@ -37,22 +28,25 @@ while getopts ":f:h:u:p:m:b:" opt; do
done
# Create a temporary file for the encrypted archive
TMP_FILENAME=duplicati_db-$(date +"%Y%m%d").bak &&
TMP_FILEPATH=$SCRIPT_ABS_LOCATION || { log "Error: Failed to create a temporary file."; exit 1; }
TMP_FILENAME="duplicati_db-$(date +"%Y%m%d").bak"
TMP_FILEPATH="$SCRIPT_ABS_LOCATION"
if [ -z "$TMP_FILEPATH" ]; then
log "Error: TMP_FILEPATH is not set."; exit 1
fi
# Create the encrypted archive using tar and openssl
log "Compressing and excrypting the Duplicati Databases"
sudo tar -czf - "$SOURCE_DIR" | openssl enc -aes-256-cbc -pbkdf2 -pass pass:$BACKUP_ENCR_PASSPHRASE > $TMP_FILEPATH/$TMP_FILENAME || { log "Error: Failed to create encrypted archive."; exit 1; }
sudo tar --absolute-names -czf - "$SOURCE_DIR" | openssl enc -aes-256-cbc -pbkdf2 -pass "pass:$BACKUP_ENCR_PASSPHRASE" > "$TMP_FILEPATH/$TMP_FILENAME" || { log "Error: Failed to create encrypted archive."; exit 1; }
# Connect to the backup host and count the number of existing backups
log "Fetching number of backups in destination folder"
EXISTING_BACKUPS=$(ssh $SSH_USERNAME@$SSH_DESTINATION -p 23 -i $SSH_KEY "ls" | sudo wc -l) || { log "Error: Failed to count existing backups."; exit 1; }
EXISTING_BACKUPS=$(ssh "$SSH_USERNAME@$SSH_DESTINATION" -p 23 -i "$SSH_KEY" 'ls' | sudo wc -l) || { log "Error: Failed to count existing backups."; exit 1; }
# Remove old backups if there are too many
if (( $EXISTING_BACKUPS > $MAX_BACKUPS )); then
if (( EXISTING_BACKUPS > MAX_BACKUPS )); then
log "Removing old backups in order to save space"
ssh $SSH_USERNAME@$SSH_DESTINATION -p 23 -i $SSH_KEY "ls -t $BACKUP_FOLDER | tail -n +$((MAX_BACKUPS+1)) | xargs rm" || { log "Error: Failed to remove old backups."; exit 1; }
ssh "$SSH_USERNAME@$SSH_DESTINATION" -p 23 -i "$SSH_KEY" "ls -t $BACKUP_FOLDER | tail -n +$((MAX_BACKUPS+1)) | xargs rm" || { log "Error: Failed to remove old backups."; exit 1; }
fi
# Transfer the encrypted archive to the backup host using scp

View file

@ -1,25 +1,21 @@
#!/bin/bash
SCRIPT_ABS_LOCATION=$(realpath "$(dirname "${0}")")
source $SCRIPT_ABS_LOCATION/forgejo-backup.env
source $SCRIPT_ABS_LOCATION/../logger.sh
# shellcheck disable=SC1090
source "$SCRIPT_ABS_LOCATION/forgejo-backup.env"
# shellcheck disable=SC1090
source "$SCRIPT_ABS_LOCATION/../logger.sh"
# Container Names
APP_CONTAINER="forgejo"
BACKUP_CONTAINER="duplicati"
SOURCE_DIR="/mnt/data/forgejo"
BACKUP_DESTINATION="$BACKUP_DESTINATION"
BACKUP_ENCR_PASSPHRASE="$BACKUP_ENCR_PASSPHRASE"
# Cloud Storage Authentication
SFTP_USERNAME="$SFTP_USERNAME"
SFTP_PASSWORD="$SFTP_PASSWORD"
SFTP_FINGERPRINT="$SFTP_FINGERPRINT"
BACKUP_CONTAINER="duplicati"
# Log file
LOG_FILE="$SCRIPT_ABS_LOCATION/forgejo-backup.log"
SOURCE_DIR="/mnt/data/forgejo"
# Stop forgejo container
log "Stopping forgejo container..."
docker stop $APP_CONTAINER || { log "Error: Failed to stop forgejo."; exit 1; }
@ -28,18 +24,18 @@ docker stop $APP_CONTAINER || { log "Error: Failed to stop forgejo."; exit 1; }
log "Backing up forgejo files (including the SQLite database)..."
docker exec $BACKUP_CONTAINER \
duplicati-cli backup \
ssh://$BACKUP_DESTINATION \
$SOURCE_DIR \
"ssh://$BACKUP_DESTINATION" \
"$SOURCE_DIR" \
--backup-name="forgejo backup" \
--keep-versions=7 \
--auth-username=$SFTP_USERNAME \
--auth-password=$SFTP_PASSWORD \
--passphrase=$BACKUP_ENCR_PASSPHRASE \
--auth-username="$SFTP_USERNAME" \
--auth-password="$SFTP_PASSWORD" \
--passphrase="$BACKUP_ENCR_PASSPHRASE" \
--ssh-fingerprint="$SFTP_FINGERPRINT" \
--prefix="forgejo" || { log "Error: Failed to backup forgejo files and database."; exit 1; }
# Turn off Maintenance Mode
log "Starting forgejo container..."
docker start $APP_CONTAINER || { log "Error: Failed to start forgejo container."; exit 1; }
docker start "$APP_CONTAINER" || { log "Error: Failed to start forgejo container."; exit 1; }
log "Forgejo backup completed successfully."

View file

@ -8,7 +8,7 @@ declare -a apps=("cryptpad" "immich" "duplicati" "nextcloud" "vaultwarden" "forg
# Function to execute the backup script for each application
backup_app() {
local app=$1
$SCRIPT_ABS_LOCATION/$app/${app}-backup.sh
"$SCRIPT_ABS_LOCATION/$app/${app}-backup.sh"
}
# Iterate over each app in the array and call the backup function

View file

@ -1,55 +1,50 @@
#!/bin/bash
SCRIPT_ABS_LOCATION=$(realpath "$(dirname "${0}")")
source $SCRIPT_ABS_LOCATION/immich-backup.env
source $SCRIPT_ABS_LOCATION/../logger.sh
# shellcheck disable=SC1090
source "$SCRIPT_ABS_LOCATION/immich-backup.env"
# shellcheck disable=SC1090
source "$SCRIPT_ABS_LOCATION/../logger.sh"
# Container Names
APP_CONTAINER="immich_server"
DB_CONTAINER="immich_postgres"
BACKUP_CONTAINER="duplicati"
# Log file
LOG_FILE="$SCRIPT_ABS_LOCATION/immich-backup.log"
# Database Settings
DB_USER="postgres"
SOURCE_DIR="/mnt/data/immich"
BACKUP_DESTINATION="$BACKUP_DESTINATION"
BACKUP_ENCR_PASSPHRASE="$BACKUP_ENCR_PASSPHRASE"
# Cloud Storage Authentication
SFTP_USERNAME="$SFTP_USERNAME"
SFTP_PASSWORD="$SFTP_PASSWORD"
SFTP_FINGERPRINT="$SFTP_FINGERPRINT"
# Log file
LOG_FILE="$SCRIPT_ABS_LOCATION/immich-backup.log"
# Dump Database
log "Dumping immich postgresql database..."
DB_TMP_BAK_NAME="postgres_$(date +"%Y%m%d").bak"
docker exec -t $DB_CONTAINER pg_dumpall \
docker exec -t "$DB_CONTAINER" pg_dumpall \
--clean \
--if-exists \
--username=postgres \
--file=/var/lib/postgresql/data/$DB_TMP_BAK_NAME || { log "Error: Failed to dump the immich database."; exit 1; }
--username="$DB_USER" \
--file="/var/lib/postgresql/data/$DB_TMP_BAK_NAME" || { log "Error: Failed to dump the immich database."; exit 1; }
# Backup all files to target destination
log "Backing up immich files and database..."
docker exec $BACKUP_CONTAINER duplicati-cli backup ssh://$BACKUP_DESTINATION \
$SOURCE_DIR/data/library \
$SOURCE_DIR/data/upload \
$SOURCE_DIR/data/profile \
$SOURCE_DIR/postgres/$DB_TMP_BAK_NAME \
docker exec "$BACKUP_CONTAINER" duplicati-cli backup "ssh://$BACKUP_DESTINATION" \
"$SOURCE_DIR/data/library" \
"$SOURCE_DIR/data/upload" \
"$SOURCE_DIR/data/profile" \
"$SOURCE_DIR/postgres/$DB_TMP_BAK_NAME" \
--backup-name="immich backup" \
--keep-versions=7 \
--auth-username=$SFTP_USERNAME \
--auth-password=$SFTP_PASSWORD \
--auth-username="$SFTP_USERNAME" \
--auth-password="$SFTP_PASSWORD" \
--passphrase="$BACKUP_ENCR_PASSPHRASE" \
--ssh-fingerprint="$SFTP_FINGERPRINT" \
--prefix="immich" || { log "Error: Failed to backup immich files and database."; exit 1; }
# Delete temporary backup files
log "Deleting temporary backup files..."
docker exec $DB_CONTAINER rm /var/lib/postgresql/data/$DB_TMP_BAK_NAME || { log "Error: Failed to delete temporary backup files."; exit 1; }
docker exec "$DB_CONTAINER" rm "/var/lib/postgresql/data/$DB_TMP_BAK_NAME" || { log "Error: Failed to delete temporary backup files."; exit 1; }
log "immich backup completed successfully."

View file

@ -1,67 +1,62 @@
#!/bin/bash
SCRIPT_ABS_LOCATION=$(realpath "$(dirname "${0}")")
source $SCRIPT_ABS_LOCATION/nextcloud-backup.env
source $SCRIPT_ABS_LOCATION/../logger.sh
# shellcheck disable=SC1090
source "$SCRIPT_ABS_LOCATION/nextcloud-backup.env"
# shellcheck disable=SC1090
source "$SCRIPT_ABS_LOCATION/../logger.sh"
# Container Names
APP_CONTAINER="nextcloud-app"
DB_CONTAINER="nextcloud-db"
BACKUP_CONTAINER="duplicati"
# Database Settings
DB_USER="nextcloud"
DB_PASSWORD="$DB_PASSWORD"
SOURCE_DIR="/mnt/data/nextcloud"
BACKUP_DESTINATION="$BACKUP_DESTINATION"
BACKUP_ENCR_PASSPHRASE="$BACKUP_ENCR_PASSPHRASE"
# Cloud Storage Authentication
SFTP_USERNAME="$SFTP_USERNAME"
SFTP_PASSWORD="$SFTP_PASSWORD"
SFTP_FINGERPRINT="$SFTP_FINGERPRINT"
BACKUP_CONTAINER="duplicati"
# Log file
LOG_FILE="$SCRIPT_ABS_LOCATION/nextcloud-backup.log"
# Database Settings
DB_USER="nextcloud"
SOURCE_DIR="/mnt/data/nextcloud"
# Put Nextcloud in Maintenance Mode
log "Putting Nextcloud in maintenance mode..."
docker exec -u www-data $APP_CONTAINER php occ maintenance:mode --on || { log "Error: Failed to put Nextcloud in maintenance mode."; exit 1; }
docker exec -u www-data "$APP_CONTAINER" php occ maintenance:mode --on || { log "Error: Failed to put Nextcloud in maintenance mode."; exit 1; }
# Dump Database
log "Dumping Nextcloud database..."
DB_TMP_BAK_NAME="nextcloud-db_$(date +"%Y%m%d").bak"
docker exec $DB_CONTAINER /usr/bin/mariadb-dump \
docker exec "$DB_CONTAINER" /usr/bin/mariadb-dump \
--single-transaction \
-h localhost \
-u $DB_USER \
-u "$DB_USER" \
-p"$DB_PASSWORD" \
nextcloud > $SOURCE_DIR/$DB_TMP_BAK_NAME || { log "Error: Failed to dump the Nextcloud database."; exit 1; }
nextcloud > "$SOURCE_DIR/$DB_TMP_BAK_NAME" || { log "Error: Failed to dump the Nextcloud database."; exit 1; }
# Backup all files to target destination
log "Backing up Nextcloud files and database..."
docker exec $BACKUP_CONTAINER \
docker exec "$BACKUP_CONTAINER" \
duplicati-cli backup \
ssh://$BACKUP_DESTINATION \
"ssh://$BACKUP_DESTINATION" \
"$SOURCE_DIR/html/data" \
"$SOURCE_DIR/html/config" \
"$SOURCE_DIR/html/themes" \
"$SOURCE_DIR/$DB_TMP_BAK_NAME" \
--backup-name="nextcloud backup" \
--keep-versions=7 \
--auth-username=$SFTP_USERNAME \
--auth-password=$SFTP_PASSWORD \
--passphrase=$BACKUP_ENCR_PASSPHRASE \
--auth-username="$SFTP_USERNAME" \
--auth-password="$SFTP_PASSWORD" \
--passphrase="$BACKUP_ENCR_PASSPHRASE" \
--ssh-fingerprint="$SFTP_FINGERPRINT" \
--prefix="nextcloud" || { log "Error: Failed to backup Nextcloud files and database."; exit 1; }
# Turn off Maintenance Mode
log "Turning off Nextcloud maintenance mode..."
docker exec -u www-data $APP_CONTAINER php occ maintenance:mode --off || { log "Error: Failed to turn off Nextcloud maintenance mode."; exit 1; }
docker exec -u www-data "$APP_CONTAINER" php occ maintenance:mode --off || { log "Error: Failed to turn off Nextcloud maintenance mode."; exit 1; }
# Delete temporary backup files
log "Deleting temporary backup files..."
rm $SOURCE_DIR/$DB_TMP_BAK_NAME || { log "Error: Failed to delete temporary databse file"; exit 1; }
rm "$SOURCE_DIR/$DB_TMP_BAK_NAME" || { log "Error: Failed to delete temporary databse file"; exit 1; }
log "Nextcloud backup completed successfully."

View file

@ -1,45 +1,41 @@
#!/bin/bash
SCRIPT_ABS_LOCATION=$(realpath "$(dirname "${0}")")
source $SCRIPT_ABS_LOCATION/portainer-backup.env
source $SCRIPT_ABS_LOCATION/../logger.sh
# shellcheck disable=SC1090
source "$SCRIPT_ABS_LOCATION/portainer-backup.env"
# shellcheck disable=SC1090
source "$SCRIPT_ABS_LOCATION/../logger.sh"
# Container Names
APP_CONTAINER="portainer"
BACKUP_CONTAINER="duplicati"
SOURCE_DIR="/volumes/portainer"
BACKUP_DESTINATION="$BACKUP_DESTINATION"
BACKUP_ENCR_PASSPHRASE="$BACKUP_ENCR_PASSPHRASE"
# Cloud Storage Authentication
SFTP_USERNAME="$SFTP_USERNAME"
SFTP_PASSWORD="$SFTP_PASSWORD"
SFTP_FINGERPRINT="$SFTP_FINGERPRINT"
# Log file
LOG_FILE="$SCRIPT_ABS_LOCATION/portainer-backup.log"
SOURCE_DIR="/volumes/portainer"
# Stop portainer container
log "Stopping portainer container..."
docker stop $APP_CONTAINER || { log "Error: Failed to stop portainer."; exit 1; }
# Backup all files to target destination
log "Backing up portainer files (including the SQLite database)..."
docker exec $BACKUP_CONTAINER \
docker exec "$BACKUP_CONTAINER" \
duplicati-cli backup \
ssh://$BACKUP_DESTINATION \
$SOURCE_DIR \
"ssh://$BACKUP_DESTINATION" \
"$SOURCE_DIR" \
--backup-name="portainer backup" \
--keep-versions=7 \
--auth-username=$SFTP_USERNAME \
--auth-password=$SFTP_PASSWORD \
--passphrase=$BACKUP_ENCR_PASSPHRASE \
--auth-username="$SFTP_USERNAME" \
--auth-password="$SFTP_PASSWORD" \
--passphrase="$BACKUP_ENCR_PASSPHRASE" \
--ssh-fingerprint="$SFTP_FINGERPRINT" \
--prefix="portainer" || { log "Error: Failed to backup portainer files and database."; exit 1; }
# Turn off Maintenance Mode
log "Starting portainer container..."
docker start $APP_CONTAINER || { log "Error: Failed to start portainer container."; exit 1; }
docker start "$APP_CONTAINER" || { log "Error: Failed to start portainer container."; exit 1; }
log "portainer backup completed successfully."

View file

@ -1,45 +1,40 @@
#!/bin/bash
SCRIPT_ABS_LOCATION=$(realpath "$(dirname "${0}")")
source $SCRIPT_ABS_LOCATION/vaultwarden-backup.env
source $SCRIPT_ABS_LOCATION/../logger.sh
# shellcheck disable=SC1090
source "$SCRIPT_ABS_LOCATION/vaultwarden-backup.env"
# shellcheck disable=SC1090
source "$SCRIPT_ABS_LOCATION/../logger.sh"
# Container Names
CONTAINER="vaultwarden"
BACKUP_CONTAINER="duplicati"
SOURCE_DIR="/mnt/data/vaultwarden"
BACKUP_DESTINATION="$BACKUP_DESTINATION"
BACKUP_ENCR_PASSPHRASE="$BACKUP_ENCR_PASSPHRASE"
# Cloud Storage Authentication
SFTP_USERNAME="$SFTP_USERNAME"
SFTP_PASSWORD="$SFTP_PASSWORD"
SFTP_FINGERPRINT="$SFTP_FINGERPRINT"
BACKUP_CONTAINER="duplicati"
# Log file
LOG_FILE="$SCRIPT_ABS_LOCATION/vaultwarden-backup.log"
# Dump Database
SOURCE_DIR="/mnt/data/vaultwarden"
# Dump Database
log "Dumping vaultwarden database..."
DB_TMP_BAK_NAME=vaultwarden-db_$(date +"%Y%m%d").sqlite3
sqlite3 $SOURCE_DIR/db.sqlite3 ".backup '$SOURCE_DIR/$DB_TMP_BAK_NAME'" || { log "Error: Failed to dump the Nextcloud database."; exit 1; }
sqlite3 "$SOURCE_DIR/db.sqlite3" ".backup $SOURCE_DIR/$DB_TMP_BAK_NAME" || { log "Error: Failed to dump the Nextcloud database."; exit 1; }
# Backup all files to target destination
log "Backing up vaultwarden files and database..."
docker exec $BACKUP_CONTAINER duplicati-cli backup \
ssh://$BACKUP_DESTINATION \
$SOURCE_DIR \
docker exec "$BACKUP_CONTAINER" duplicati-cli backup \
"ssh://$BACKUP_DESTINATION" \
"$SOURCE_DIR" \
--backup-name="vaultwarden backup" \
--keep-versions=7 \
--auth-username=$SFTP_USERNAME \
--auth-password=$SFTP_PASSWORD \
--auth-username="$SFTP_USERNAME" \
--auth-password="$SFTP_PASSWORD" \
--passphrase="$BACKUP_ENCR_PASSPHRASE" \
--ssh-fingerprint="$SFTP_FINGERPRINT" \
--prefix="vaultwarden" || { log "Error: Failed to backup vaultwarden files and database."; exit 1; }
# Delete temporary backup files
log "Deleting temporary backup files..."
rm $SOURCE_DIR/$DB_TMP_BAK_NAME || { log "Error: Failed to delete temporary backup files."; exit 1; }
rm "$SOURCE_DIR/$DB_TMP_BAK_NAME" || { log "Error: Failed to delete temporary backup files."; exit 1; }
log "vaultwarden backup completed successfully."