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.
This commit is contained in:
12
hanatool.sh
12
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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user