From 8a8a11ace6f7ee4ef2282193cf0fb2e607e64155 Mon Sep 17 00:00:00 2001 From: TomiEckert Date: Thu, 16 Apr 2026 15:24:42 +0200 Subject: [PATCH] update hanamgr --- hanamgr.sh | 24 ++++++++++++++++++------ packages.conf | 2 +- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/hanamgr.sh b/hanamgr.sh index af76732..106a59d 100755 --- a/hanamgr.sh +++ b/hanamgr.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Version: 1.1.0 +# Version: 1.2.0 # Author: Tomi Eckert # ============================================================================== # HANA Database Manager Menu (hanamgr.sh) @@ -86,7 +86,7 @@ select_schema() { echo -e "\n\033[1mAvailable Schemas:\033[0m" for i in "${!schemas[@]}"; do echo "$((i+1))) ${schemas[$i]}" - fi + done echo "0) Enter manually" echo @@ -113,8 +113,14 @@ do_export() { select_schema "$user_key" local schema_name="$SELECTED_SCHEMA" read -p "Enter Target Directory Path: " target_path - read -p "Number of threads (default: 1): " threads - threads=${threads:-1} + + local max_threads=$(nproc 2>/dev/null || echo 1) + local half_threads=$((max_threads / 2)) + [[ $half_threads -lt 1 ]] && half_threads=1 + + read -p "Number of threads (default: $half_threads, max: $max_threads): " threads + threads=${threads:-$half_threads} + read -p "Compress output as tar.gz? (y/N): " compress if [[ -z "$user_key" || -z "$schema_name" || -z "$target_path" ]]; then @@ -182,8 +188,14 @@ do_import() { fi read -p "Enter Source Path (Directory or .tar.gz): " source_path - read -p "Number of threads (default: 1): " threads - threads=${threads:-1} + + local max_threads=$(nproc 2>/dev/null || echo 1) + local half_threads=$((max_threads / 2)) + [[ $half_threads -lt 1 ]] && half_threads=1 + + read -p "Number of threads (default: $half_threads, max: $max_threads): " threads + threads=${threads:-$half_threads} + read -p "Replace existing objects? (y/N): " replace_opt if [[ -z "$user_key" || -z "$schema_name" || -z "$source_path" ]]; then diff --git a/packages.conf b/packages.conf index fe79408..fcb7dc5 100644 --- a/packages.conf +++ b/packages.conf @@ -16,4 +16,4 @@ SCRIPT_PACKAGES["monitor"]="Monitor Suite|1.3.1|Scripts for monitoring system he SCRIPT_PACKAGES["keymanager"]="Key Manager|1.2.3|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.6.0|A command-line tool for various SAP HANA administration tasks.|https://git.technopunk.space/tomi/Scripts/raw/branch/main/hanatool.sh" -SCRIPT_PACKAGES["hanamgr"]="HANA Manager UI|1.1.0|An interactive command-line menu for managing SAP HANA schemas and databases.|https://git.technopunk.space/tomi/Scripts/raw/branch/main/hanamgr.sh" +SCRIPT_PACKAGES["hanamgr"]="HANA Manager UI|1.2.0|An interactive command-line menu for managing SAP HANA schemas and databases.|https://git.technopunk.space/tomi/Scripts/raw/branch/main/hanamgr.sh"