This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 5c28958fcc3 fixed collection iotdb info unable to obtain information
(#11881)
5c28958fcc3 is described below
commit 5c28958fcc3b6ba27be4d88f47995a3172e532ae
Author: CloudWise-Lukemiao
<[email protected]>
AuthorDate: Fri Jan 12 17:28:17 2024 +0800
fixed collection iotdb info unable to obtain information (#11881)
Co-authored-by: luke.miao <[email protected]>
---
.../{collection-info.bat => collect-info.bat} | 206 ++++++++++----------
.../tools/{collection-info.sh => collect-info.sh} | 212 +++++++++++++--------
2 files changed, 236 insertions(+), 182 deletions(-)
diff --git a/iotdb-client/cli/src/assembly/resources/tools/collection-info.bat
b/iotdb-client/cli/src/assembly/resources/tools/collect-info.bat
similarity index 54%
rename from iotdb-client/cli/src/assembly/resources/tools/collection-info.bat
rename to iotdb-client/cli/src/assembly/resources/tools/collect-info.bat
index 2cde0416465..afd0a106328 100644
--- a/iotdb-client/cli/src/assembly/resources/tools/collection-info.bat
+++ b/iotdb-client/cli/src/assembly/resources/tools/collect-info.bat
@@ -25,18 +25,33 @@ if NOT DEFINED IOTDB_HOME set IOTDB_HOME=%cd%
popd
setlocal enabledelayedexpansion
-set "timestamp=%date:~0,4%%date:~5,2%%date:~8,2%"
-set "COLLECTION_DIR=%IOTDB_HOME%\collectioninfo"
-set "COLLECTION_FILE=%COLLECTION_DIR%\collection-%timestamp%.txt"
+
+set "COLLECTION_DIR_NAME=iotdb-info"
+set "COLLECTION_DIR=%IOTDB_HOME%\%COLLECTION_DIR_NAME%"
+set "COLLECTION_DIR_LOGS=%COLLECTION_DIR%\logs"
+set "COLLECTION_FILE=%COLLECTION_DIR%\collection.txt"
set "START_CLI_PATH=%IOTDB_HOME%\sbin\start-cli.bat"
-set "HELP=Usage: %0 [-h <ip>] [-p <port>] [-u <username>] [-pw <password>]
[-jp <jdk_path>] [-dd <data_dir>]"
+set "HELP=Usage: %0 [-h <ip>] [-p <port>] [-u <username>] [-pw <password>]
[-dd <data_dir>]"
set "user_param=root"
set "passwd_param=root"
set "host_param=127.0.0.1"
set "port_param=6667"
-set "jdk_path_param="
-set "data_dir_param=%IOTDB_HOME%\data"
+
+set "properties_file=%IOTDB_HOME%\conf\iotdb-datanode.properties"
+set "key=dn_data_dirs"
+
+for /f "usebackq tokens=1,* delims==" %%a in ("%properties_file%") do (
+ if "%%a"=="%key%" (
+ set "value=%%b"
+ )
+)
+
+IF "%value%"=="" (
+ set "data_dir_param=%IOTDB_HOME%\data\datanode\data"
+) else (
+ set "data_dir_param=%value%"
+)
:parse_args
if "%~1"=="" goto done
@@ -64,12 +79,6 @@ if "%~1"=="-p" (
shift
goto parse_args
)
-if "%~1"=="-jp" (
- set "jdk_path_param=%~2"
- shift
- shift
- goto parse_args
-)
if "%~1"=="-dd" (
set "data_dir_param=%~2"
shift
@@ -91,68 +100,37 @@ echo data_dir_param: %data_dir_param%
set "command=show version"
call :collect_info
-call :execute_command "show version" >> "%COLLECTION_FILE%"
-call :execute_command "show cluster details" >> "%COLLECTION_FILE%"
-call :execute_command "show regions" >> "%COLLECTION_FILE%"
-call :execute_command "show databases" >> "%COLLECTION_FILE%"
-call :execute_command "count devices" >> "%COLLECTION_FILE%"
-call :execute_command "count timeseries" >> "%COLLECTION_FILE%"
echo "Program execution completed, directory name is %COLLECTION_DIR%"
exit /b
:collect_info
echo ---------------------
-echo Start Collection info
+echo Start collecting info
echo ---------------------
if exist "%COLLECTION_DIR%" rmdir /s /q "%COLLECTION_DIR%"
-mkdir "%COLLECTION_DIR%"
+mkdir "%COLLECTION_DIR_LOGS%"
xcopy /E /I /Q "%IOTDB_HOME%\conf" "%COLLECTION_DIR%\conf"
-set "files_to_zip=%COLLECTION_FILE% ../conf"
-
-call :collect_cpu_info >> "%COLLECTION_FILE%"
-call :collect_memory_info >> "%COLLECTION_FILE%"
+call :collection_logs
call :collect_system_info >> "%COLLECTION_FILE%"
call :collect_jdk_version >> "%COLLECTION_FILE%"
call :collect_activation_info >> "%COLLECTION_FILE%"
call :total_file_num >> "%COLLECTION_FILE%"
+call :execute_command "show version" >> "%COLLECTION_FILE%" 2>&1
+call :execute_command "show cluster details" >> "%COLLECTION_FILE%" 2>&1
+call :execute_command "show regions" >> "%COLLECTION_FILE%" 2>&1
+call :execute_command "show databases" >> "%COLLECTION_FILE%" 2>&1
+call :execute_command "count devices" >> "%COLLECTION_FILE%" 2>&1
+call :execute_command "count timeseries" >> "%COLLECTION_FILE%" 2>&1
exit /b
-:collect_cpu_info
-echo ====================== CPU Info ======================
-wmic cpu get name | more +1
-for /f %%b in ('wmic cpu get numberofcores ^| findstr "[0-9]"') do (
- set system_cpu_cores=%%b
-)
-if %system_cpu_cores% LSS 1 set system_cpu_cores=1
-echo %system_cpu_cores% core
-exit /b
-
-
-:collect_memory_info
-echo ===================== Memory Info =====================
-
-REM Get total memory size
-for /f %%b in ('wmic ComputerSystem get TotalPhysicalMemory ^| findstr
"[0-9]"') do (
- set system_memory=%%b
-)
-
-echo wsh.echo FormatNumber(cdbl(%system_memory%)/(1024*1024*1024), 0) > tmp.vbs
-for /f "tokens=*" %%a in ('cscript //nologo tmp.vbs') do set
system_memory_in_gb=%%a
-del tmp.vbs
-set system_memory_in_gb=%system_memory_in_gb:,=%
-
-REM Output memory information
-echo Total Memory: !system_memory_in_gb! GB
-exit /b
-
:collect_system_info
echo ===================== System Info =====================
-wmic os get Caption
+systeminfo
exit /b
:collect_jdk_version
@@ -181,15 +159,20 @@ if exist "%~dp0/../activation" (
)
exit /b
+:collection_logs
+for %%F in ("%IOTDB_HOME%\logs\*.log") do (
+ echo %%F
+ if /I "%%~xF"==".log" (
+ copy "%%F" "%COLLECTION_DIR_LOGS%"
+ )
+)
+exit /b
+
:execute_command
setlocal enabledelayedexpansion
set "command=%~1"
echo =================== "%command%" ====================
-if not "%jdk_path_param%"=="" (
- set JAVA_HOME="%jdk_path_param%";call "%START_CLI_PATH%" -h "%host_param%"
-p "%port_param%" -u "%user_param%" -pw "%passwd_param%" -e "%command%"
-) else (
- call "%START_CLI_PATH%" -h "%host_param%" -p "%port_param%" -u
"%user_param%" -pw "%passwd_param%" -e "%command%"
-)
+call "%START_CLI_PATH%" -h "%host_param%" -p "%port_param%" -u "%user_param%"
-pw "%passwd_param%" -e "%command%"
exit /b
@@ -198,78 +181,97 @@ echo '===================== TsFile
Info====================='
set "directories=%data_dir_param%"
set "seqFileCount=0"
set "unseqFileCount=0"
+
+
+set /a totalSeqFileSize=0
+set /a totalUnseqFileSize=0
+
+set "directories=!directories:,= !"
set /a seqFileSize=0
set /a unseqFileSize=0
for %%d in ("%directories: =" "%") do (
- set "seqdirectory=%%~d\datanode\data\sequence"
- set "unseqdirectory=%%~d\datanode\data\unsequence"
-
- for /f %%a in ('dir /s /b /a-d "!seqdirectory!" ^| find /c /v ""') do (
- set /a "seqFileCount+=%%a"
+ set "seqdirectory=%%~d\sequence"
+ set "unseqdirectory=%%~d\unsequence"
+ if exist "!seqdirectory!" (
+ for /f %%a in ('dir /s /b /a-d "!seqdirectory!\\*.tsfile" 2^>nul ^|
find /c /v ""') do (
+ set /a "seqFileCount+=%%a"
+ )
+ call :processDirectory "!seqdirectory!" seqFileSize
)
- for /f %%a in ('dir /s /b /a-d "!unseqdirectory!" ^| find /c /v ""') do (
- set /a "unseqFileCount+=%%a"
+ if exist "!unseqdirectory!\*" (
+ for /f %%a in ('dir /s /b /a-d "!unseqdirectory!\\*.tsfile" 2^>nul ^|
find /c /v ""') do (
+ set /a "unseqFileCount+=%%a"
+ )
+ call :processDirectory "!unseqdirectory!" unseqFileSize
)
- call :processDirectory "!seqdirectory!" seqFileSize
- call :processDirectory "!unseqdirectory!" unseqFileSize
+
+ set /a "totalSeqFileSize+=!seqFileSize!"
+ set /a "totalUnseqFileSize+=!unseqFileSize!"
)
echo sequence(tsfile number): %seqFileCount%
echo unsequence(tsfile number): %unseqFileCount%
-call :convertSize !seqFileSize! convertedSeqSize
-call :convertSize !unseqFileSize! convertedUnseqSize
+call :convertSize %totalSeqFileSize% convertedSeqSize
+call :convertSize %totalUnseqFileSize% convertedUnSeqSize
echo sequence(tsfile size): %convertedSeqSize%
-echo unsequence(tsfile size): %convertedUnseqSize%
+echo unsequence(tsfile size): %convertedUnSeqSize%
exit /b
:processDirectory
+setlocal enabledelayedexpansion
set "dir=%~1"
set "sizeVar=%~2"
-set /a "size=0"
-for /r "%dir%" %%f in (*) do (
- set /a "size+=%%~zf"
-)
+echo Set objFSO = CreateObject("Scripting.FileSystemObject") > tmp.vbs
+echo Set objFolder = objFSO.GetFolder("%dir%") >> tmp.vbs
+echo Dim totalSize >> tmp.vbs
+echo totalSize = 0 >> tmp.vbs
+echo CalculateFolderSize objFolder >> tmp.vbs
+echo WScript.Echo totalSize >> tmp.vbs
+echo Sub CalculateFolderSize(objCurrentFolder) >> tmp.vbs
+echo For Each objFile In objCurrentFolder.Files >> tmp.vbs
+echo totalSize = totalSize + objFile.Size >> tmp.vbs
+echo Next >> tmp.vbs
+
+echo For Each objSubFolder In objCurrentFolder.SubFolders >> tmp.vbs
+echo CalculateFolderSize objSubFolder >> tmp.vbs
+echo Next >> tmp.vbs
+echo End Sub >> tmp.vbs
+
+for /f "tokens=*" %%a in ('cscript //nologo tmp.vbs') do set data_size=%%a
+del tmp.vbs
-endlocal & set "%sizeVar%=%size%"
+endlocal & set "%sizeVar%=%data_size%"
exit /b
:convertSize
setlocal enabledelayedexpansion
set "size=%~1"
-set "unit=bytes"
-
-
-echo wsh.echo FormatNumber(cdbl(%size%)/(1024*1024*1024), 0) > tmp.vbs
-for /f "tokens=*" %%a in ('cscript //nologo tmp.vbs') do set data_size_gb=%%a
+echo wsh.echo FormatNumber(cdbl(%size%)/(1024), 0) > tmp.vbs
+for /f "tokens=*" %%a in ('cscript //nologo tmp.vbs') do set data_size_kb=%%a
del tmp.vbs
-set data_size_gb=%data_size_gb:,=%
+set data_size_kb=!data_size_kb:,=!
-echo wsh.echo FormatNumber(cdbl(%size%)/(1024*1024), 0) > tmp.vbs
+echo wsh.echo FormatNumber(cdbl(%size%)/(1024*1024), 1) > tmp.vbs
for /f "tokens=*" %%a in ('cscript //nologo tmp.vbs') do set data_size_mb=%%a
del tmp.vbs
-set data_size_mb=%data_size_mb:,=%
+set data_size_mb=!data_size_mb:,=!
-echo wsh.echo FormatNumber(cdbl(%size%)/(1024*1024), 0) > tmp.vbs
-for /f "tokens=*" %%a in ('cscript //nologo tmp.vbs') do set data_size_kb=%%a
+echo wsh.echo FormatNumber(cdbl(%size%)/(1024*1024*1024), 1) > tmp.vbs
+for /f "tokens=*" %%a in ('cscript //nologo tmp.vbs') do set data_size_gb=%%a
del tmp.vbs
-set data_size_kb=%data_size_kb:,=%
-
-if %data_size_gb% GTR 1 (
- set "unit=GB"
- set "data_size=%data_size_gb%"
-)else if %data_size_mb% GTR 1 (
- set "unit=MB"
- set "data_size=%data_size_mb%"
-) else if %data_size_kb% GTR 1 (
- set "unit=KB"
- set "data_size=%data_size_kb%"
-)else (
- set "data_size=%size%"
+set data_size_gb=!data_size_gb:,=!
+
+if !data_size_gb! gtr 1 (
+ set "size=!data_size_gb!GB"
+) else if !data_size_mb! gtr 1 (
+ set "size=!data_size_mb!MB"
+) else if !data_size_kb! gtr 1 (
+ set "size=!data_size_kb!KB"
+) else (
+ set "size=!size!B"
)
-
-endlocal & set "%~2=%data_size%%unit%"
-
-exit /b
\ No newline at end of file
+endlocal & set "%~2=%size%"
+exit /b
diff --git a/iotdb-client/cli/src/assembly/resources/tools/collection-info.sh
b/iotdb-client/cli/src/assembly/resources/tools/collect-info.sh
similarity index 59%
rename from iotdb-client/cli/src/assembly/resources/tools/collection-info.sh
rename to iotdb-client/cli/src/assembly/resources/tools/collect-info.sh
index 5030db6e25b..a01714b289d 100644
--- a/iotdb-client/cli/src/assembly/resources/tools/collection-info.sh
+++ b/iotdb-client/cli/src/assembly/resources/tools/collect-info.sh
@@ -20,7 +20,7 @@
#!/bin/bash
echo ---------------------
-echo Start Collection info
+echo Start collecting info
echo ---------------------
if [ -z "${IOTDB_HOME}" ]; then
@@ -28,6 +28,7 @@ if [ -z "${IOTDB_HOME}" ]; then
fi
COLLECTION_FILE="collection.txt"
+COLLECTION_DIR="iotdb-info"
HELP="Usage: $0 [-h <ip>] [-p <port>] [-u <username>] [-pw <password>] [-jp
<jdk_path>] [-dd <data_dir>]"
@@ -36,7 +37,60 @@ passwd_param="root"
host_param="127.0.0.1"
port_param="6667"
jdk_path_param=""
-data_dir_param="$IOTDB_HOME/data"
+data_dir_param="data/datanode/data"
+
+get_property_value() {
+ local file="$1" # Properties path
+ local key="$2" # key name
+ local value=""
+
+ if [ -f "$file" ]; then
+ local line=$(grep "^$key=" "$file")
+ value="${line#*=}"
+ fi
+
+ echo "$value"
+}
+
+convert_unit() {
+ local size=$1
+ local target_unit=$2
+ local converted_size=$size
+
+ if [ "$target_unit" == "M" ]; then
+ converted_size=$(awk "BEGIN {printf \"%.2f\", $size / 1024}")
+ elif [ "$target_unit" == "G" ]; then
+ converted_size=$(awk "BEGIN {printf \"%.2f\", $size / (1024 * 1024)}")
+ elif [ "$target_unit" == "T" ]; then
+ converted_size=$(awk "BEGIN {printf \"%.2f\", $size / (1024 * 1024 *
1024)}")
+ fi
+
+ echo "$converted_size"
+}
+
+choose_unit() {
+ local size=$1
+ local unit=""
+
+ if [ "$size" -lt 1024 ]; then
+ unit="K"
+ elif [ "$size" -lt 1048576 ]; then
+ unit="M"
+ elif [ "$size" -lt 1073741824 ]; then
+ unit="G"
+ else
+ unit="T"
+ fi
+
+ echo "$unit"
+}
+
+properties_file="$IOTDB_HOME/conf/iotdb-datanode.properties"
+data_dir_key="dn_data_dirs"
+value=$(get_property_value "$properties_file" "$data_dir_key")
+if [ -n "$value" ]; then
+ data_dir_param=$value
+fi
while true; do
case "$1" in
@@ -83,34 +137,55 @@ zip_directory="$IOTDB_HOME/"
files_to_zip="${COLLECTION_FILE} $IOTDB_HOME/conf"
-{
- echo '====================== CPU Info ======================'
- cat /proc/cpuinfo | awk -F ':' '/model name/ {print $2}' | uniq | tr -d
'\n'
- if [ -f /etc/centos-release ]; then
- echo -n ' '
- grep -c '^processor' /proc/cpuinfo | tr -d '\n'
- echo ' core'
- elif [ -f /etc/lsb-release ]; then
- echo -n ' '
- nproc | tr -d '\n'
- echo ' core'
- fi
-} >> "$COLLECTION_FILE"
+rm -rf $IOTDB_HOME/$COLLECTION_DIR
+mkdir -p $IOTDB_HOME/$COLLECTION_DIR/logs
{
- echo '===================== Memory Info====================='
- free -h
-} >> "$COLLECTION_FILE"
+ echo '===================== System Info ====================='
+ case "$(uname)" in
+ Linux)
+ read -r system_memory unused_memory <<< "$(free | awk
'/Mem:/{print $2, $4}')"
+ system_cpu_cores=$(grep -c 'processor' /proc/cpuinfo)
+ system_cpu_name=$(grep 'model name' /proc/cpuinfo | head -n 1 |
awk -F ':' '{$1=$1}1')
+ system_os_info=$(get_property_value /etc/os-release PRETTY_NAME)
+ ;;
+ FreeBSD)
+ read -r system_memory_in_bytes unused_memory <<< "$(sysctl -n
hw.realmem vm.stats.vm.v_inactive_count)"
+ system_memory=$((system_memory_in_bytes / 1024))
+ unused_memory=$(sysctl -n vm.stats.vm.v_inactive_count)
+ system_cpu_cores=$(sysctl -n hw.ncpu)
+ system_cpu_name=$(sysctl -n hw.model)
+ system_os_info=$(uname -r)
+ ;;
+ SunOS)
+ read -r system_memory unused_memory <<< "$(prtconf | awk '/Memory
size:/ {print $3}') $(kstat -p unix:0:system_pages:pagestotal -s
unix:0:system_pages:pagesfree | awk '{print $2}')"
+ system_cpu_cores=$(psrinfo | wc -l)
+ system_cpu_name=$(psrinfo -pv | grep "The" | awk -F':' '{print
$2}' | awk '{$1=$1}1' | head -n 1)
+ system_os_info=$(uname -v)
+ ;;
+ Darwin)
+ read -r system_memory_in_bytes unused_memory <<< "$(sysctl -n
hw.memsize) $(vm_stat | awk '/Pages free/ {print $3 * 4}')"
+ system_memory=$((system_memory_in_bytes / 1024))
+ system_cpu_cores=$(sysctl -n hw.ncpu)
+ system_cpu_name=$(sysctl -n machdep.cpu.brand_string)
+ system_os_info=$(sw_vers -productName)
+ ;;
+ *)
+ system_memory="Unknown"
+ unused_memory="Unknown"
+ system_cpu_cores="Unknown"
+ system_cpu_name="Unknown"
+ system_os_info="Unknown"
+ ;;
+ esac
+ echo "Operating System: $system_os_info"
+ echo "CPU Name: $system_cpu_name"
+ echo "CPU Cores: $system_cpu_cores"
+ total_unit=$(choose_unit "$system_memory")
+ echo "System Memory Total: $(convert_unit "$system_memory" "$total_unit")
$total_unit"
+ unuse_unit=$(choose_unit "$unused_memory")
+ echo "Unused Memory: $(convert_unit "$unused_memory" "$unuse_unit")
$unuse_unit"
-{
- echo '===================== System Info====================='
- if [ -f /etc/centos-release ]; then
- cat /etc/centos-release
- elif [ -f /etc/lsb-release ]; then
- awk -F '=' '/DESCRIPTION/ {print $2}' /etc/lsb-release | tr -d '"'
- else
- echo "Unsupported Linux distribution"
- fi
} >> "$COLLECTION_FILE"
{
@@ -155,49 +230,27 @@ files_to_zip="${COLLECTION_FILE} $IOTDB_HOME/conf"
fi
} >> "$COLLECTION_FILE"
-convert_unit() {
- local size=$1
- local target_unit=$2
- local converted_size=$size
-
- if [ "$target_unit" == "M" ]; then
- converted_size=$(awk "BEGIN {printf \"%.2f\", $size / 1024}")
- elif [ "$target_unit" == "G" ]; then
- converted_size=$(awk "BEGIN {printf \"%.2f\", $size / (1024 * 1024)}")
- elif [ "$target_unit" == "T" ]; then
- converted_size=$(awk "BEGIN {printf \"%.2f\", $size / (1024 * 1024 *
1024)}")
- fi
-
- echo "$converted_size"
-}
-
-choose_unit() {
- local size=$1
- local unit=""
-
- if [ "$size" -lt 1024 ]; then
- unit="K"
- elif [ "$size" -lt 1048576 ]; then
- unit="M"
- elif [ "$size" -lt 1073741824 ]; then
- unit="G"
- else
- unit="T"
- fi
-
- echo "$unit"
+{
+ if [[ -d "$IOTDB_HOME/logs/" ]]; then
+ for file in $IOTDB_HOME/logs/*.log; do
+ if [[ $file =~ \.log$ ]]; then
+ cp "$file" "$IOTDB_HOME/$COLLECTION_DIR/logs"
+ fi
+ done
+ else
+ echo "Directory $IOTDB_HOME/logs/ does not exist."
+ fi
}
calculate_directory_size() {
local file_type="$1"
local total_size=0
- IFS=' ' read -ra dirs <<< "$data_dir_param"
+ IFS=',' read -ra dirs <<< "$data_dir_param"
for dir in "${dirs[@]}"; do
- iotdb_data_dir="$dir/datanode/data/$file_type"
- if [ -n "$data_dir_param" ]; then
- iotdb_data_dir="$dir/$file_type"
+ if [[ $dir == /* ]]; then
+ iotdb_data_dir="$dir/$file_type"
else
- iotdb_data_dir="$dir/datanode/data/$file_type"
+ iotdb_data_dir="$IOTDB_HOME/$dir/$file_type"
fi
if [ -d "$iotdb_data_dir" ]; then
local size=$(du -s "$iotdb_data_dir" | awk '{print $1}')
@@ -210,17 +263,17 @@ calculate_directory_size() {
calculate_file_num() {
local file_type="$1"
local total_num=0
- IFS=' ' read -ra dirs <<< "$data_dir_param"
+ IFS=',' read -ra dirs <<< "$data_dir_param"
for dir in "${dirs[@]}"; do
- if [ -n "$data_dir_param" ]; then
- iotdb_data_dir="$dir/$file_type"
- else
- iotdb_data_dir="$dir/datanode/data/$file_type"
- fi
- if [ -d "$iotdb_data_dir" ]; then
- local num=$(find "$iotdb_data_dir" -type f ! -name
"*.tsfile.resource" | wc -l)
- total_num=$((total_num + num))
- fi
+ if [[ $dir == /* ]]; then
+ iotdb_data_dir="$dir/$file_type"
+ else
+ iotdb_data_dir="$IOTDB_HOME/$dir/$file_type"
+ fi
+ if [ -d "$iotdb_data_dir" ]; then
+ local num=$(find "$iotdb_data_dir" -type f ! -name
"*.tsfile.resource" | wc -l)
+ total_num=$((total_num + num))
+ fi
done
echo "$total_num"
}
@@ -246,9 +299,9 @@ execute_command_and_append_to_file() {
{
echo "=================== $command ===================="
if [ -n "$jdk_path_param" ]; then
- export JAVA_HOME="$jdk_path_param";"$IOTDB_HOME"/sbin/start-cli.sh
-h "$host_param" -p "$port_param" -u "$user_param" -pw "$passwd_param" -e
"$command" | sed '$d' | sed '$d'
+ export JAVA_HOME="$jdk_path_param";"$IOTDB_HOME"/sbin/start-cli.sh
-h "$host_param" -p "$port_param" -u "$user_param" -pw "$passwd_param" -e
"$command"
else
- "$IOTDB_HOME"/sbin/start-cli.sh -h "$host_param" -p "$port_param" -u
"$user_param" -pw "$passwd_param" -e "$command" | sed '$d' | sed '$d'
+ "$IOTDB_HOME"/sbin/start-cli.sh -h "$host_param" -p "$port_param" -u
"$user_param" -pw "$passwd_param" -e "$command"
fi
} >> "$COLLECTION_FILE"
}
@@ -260,9 +313,8 @@ execute_command_and_append_to_file 'show databases'
execute_command_and_append_to_file 'count devices'
execute_command_and_append_to_file 'count timeseries'
-rm -rf $IOTDB_HOME/collectioninfo
-mkdir -p $IOTDB_HOME/collectioninfo
-mv $COLLECTION_FILE $IOTDB_HOME/collectioninfo
-cp -r $IOTDB_HOME/conf $IOTDB_HOME/collectioninfo
-zip -r "$IOTDB_HOME/$zip_name" $IOTDB_HOME/collectioninfo
+
+mv $COLLECTION_FILE $IOTDB_HOME/$COLLECTION_DIR
+cp -r $IOTDB_HOME/conf $IOTDB_HOME/$COLLECTION_DIR
+zip -r "$IOTDB_HOME/$zip_name" $IOTDB_HOME/$COLLECTION_DIR
echo "Program execution completed, file name is $zip_name"
\ No newline at end of file