ZoopaMario
4b8546c6a1
Add a library file containing common logic to be sourced by individual backup scripts
38 lines
1 KiB
Bash
Executable file
38 lines
1 KiB
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/nextcloud-backup.env"
|
|
|
|
# shellcheck disable=SC2034
|
|
LOG_FILE="$SCRIPT_ABS_LOCATION/nextcloud-backup.log"
|
|
|
|
enable_maintenance_mode "$APP_CONTAINER" "php occ maintenance:mode --on"
|
|
|
|
dump_mariadb_db "$DB_CONTAINER" "$DB_USER" "$DB_PASSWORD" "nextcloud" "$SOURCE_DIR/$DB_TMP_BAK_NAME"
|
|
|
|
# Cant use $APP_CONTAINER as second parameter here as it contains a hyphen
|
|
run_duplicati_backup \
|
|
"$BACKUP_DESTINATION" \
|
|
"nextcloud" \
|
|
7 \
|
|
"$SFTP_USERNAME" \
|
|
"$SFTP_PASSWORD" \
|
|
"$SFTP_FINGERPRINT" \
|
|
"$BACKUP_ENCR_PASSPHRASE" \
|
|
"$SOURCE_DIR/html/data" \
|
|
"$SOURCE_DIR/html/config" \
|
|
"$SOURCE_DIR/html/themes" \
|
|
"$SOURCE_DIR/$DB_TMP_BAK_NAME"
|
|
|
|
disable_maintenance_mode "$APP_CONTAINER" "php occ maintenance:mode --off"
|
|
|
|
log "Deleting Nextcloud temp DB backup..."
|
|
rm "$SOURCE_DIR/$DB_TMP_BAK_NAME" || {
|
|
log "Error: Failed to delete temp DB backup."
|
|
exit 1
|
|
}
|
|
|