From d428def0a23afc65415da80d5cf93665f435df1f Mon Sep 17 00:00:00 2001 From: Tomi Eckert Date: Wed, 8 Oct 2025 19:26:39 +0200 Subject: [PATCH] feat(hanatool): Improve compressed tenant backup logic Refactored the compressed tenant backup process to use a temporary directory within the specified TARGET_PATH, aligning its behavior with schema exports. This change avoids the use of the /tmp directory, which can be too small for large backups. - Create a temporary directory in TARGET_PATH for the backup. - Perform the tenant backup into this temporary directory. - Compress the backup files to a .tar.gz archive in TARGET_PATH. - Clean up the temporary backup directory after compression. - Bumped hanatool.sh version to 1.5.2. - Updated hanatool version in packages.conf to 1.5.2. --- hanatool.sh | 12 +++++------- packages.conf | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/hanatool.sh b/hanatool.sh index 243403c..3925548 100644 --- a/hanatool.sh +++ b/hanatool.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Version: 1.5.1 +# Version: 1.5.2 # ============================================================================== # SAP HANA Schema and Tenant Management Tool (hanatool.sh) # @@ -149,21 +149,19 @@ case "$ACTION" in echo " - Compress: ${COMPRESS}" timestamp=$(date +%Y%m%d_%H%M%S) - backup_target_dir="" + backup_target_dir="$TARGET_PATH" # Initialize with TARGET_PATH backup_path_prefix="" if [[ "$COMPRESS" == "true" ]]; then if [[ "$DRY_RUN" == "true" ]]; then - backup_target_dir="/tmp/tenant_backup_DRYRUN_TEMP" + backup_target_dir="${TARGET_PATH}/tenant_backup_DRYRUN_TEMP" # Use TARGET_PATH else - backup_target_dir=$(mktemp -d "/tmp/tenant_backup_${timestamp}_XXXXXXXX") + backup_target_dir=$(mktemp -d "${TARGET_PATH}/tenant_backup_${timestamp}_XXXXXXXX") # Use TARGET_PATH fi echo "ℹ️ Using temporary backup directory: ${backup_target_dir}" - else - backup_target_dir="$TARGET_PATH" fi - if [[ "$DRY_RUN" == "true" && "$COMPRESS" == "false" ]]; then + if [[ "$DRY_RUN" == "true" ]]; then echo "[DRY RUN] Would create directory: mkdir -p \"$backup_target_dir\"" else mkdir -p "$backup_target_dir" diff --git a/packages.conf b/packages.conf index 8927b9d..f3d1f35 100644 --- a/packages.conf +++ b/packages.conf @@ -14,4 +14,4 @@ SCRIPT_PACKAGES["backup"]="Backup Suite|1.0.5|A comprehensive script for backing SCRIPT_PACKAGES["monitor"]="Monitor Suite|1.3.1|Scripts for monitoring system health and performance metrics.|https://git.technopunk.space/tomi/Scripts/raw/branch/main/monitor/monitor.sh https://git.technopunk.space/tomi/Scripts/raw/branch/main/monitor/monitor.conf|https://git.technopunk.space/tomi/Scripts/raw/branch/main/monitor/monitor.hook.sh" SCRIPT_PACKAGES["keymanager"]="Key Manager|1.2.1|A utility for managing HDB user keys for SAP HANA.|https://git.technopunk.space/tomi/Scripts/raw/branch/main/keymanager.sh" SCRIPT_PACKAGES["cleaner"]="File Cleaner|1.1.0|A simple script to clean up temporary files and logs.|https://git.technopunk.space/tomi/Scripts/raw/branch/main/cleaner.sh" -SCRIPT_PACKAGES["hanatool"]="HANA Tool|1.5.1|A command-line tool for various SAP HANA administration tasks.|https://git.technopunk.space/tomi/Scripts/raw/branch/main/hanatool.sh" +SCRIPT_PACKAGES["hanatool"]="HANA Tool|1.5.2|A command-line tool for various SAP HANA administration tasks.|https://git.technopunk.space/tomi/Scripts/raw/branch/main/hanatool.sh"