You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ge...@apache.org on 2020/12/30 09:16:52 UTC
[iotdb] 02/02: add shell
This is an automated email from the ASF dual-hosted git repository.
geniuspig pushed a commit to branch monitor_tool
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 4f3377dad376c7af3e8e375b5d0fafc395e0161a
Author: Boris <96...@qq.com>
AuthorDate: Wed Dec 30 17:15:59 2020 +0800
add shell
---
.../assembly/resources/tools/iotdb-diagnosis.bat | 57 ++++++++++++++++++++++
.../assembly/resources/tools/iotdb-diagnosis.sh | 53 ++++++++++++++++++++
2 files changed, 110 insertions(+)
diff --git a/cli/src/assembly/resources/tools/iotdb-diagnosis.bat b/cli/src/assembly/resources/tools/iotdb-diagnosis.bat
new file mode 100644
index 0000000..03570f0
--- /dev/null
+++ b/cli/src/assembly/resources/tools/iotdb-diagnosis.bat
@@ -0,0 +1,57 @@
+@REM
+@REM Licensed to the Apache Software Foundation (ASF) under one
+@REM or more contributor license agreements. See the NOTICE file
+@REM distributed with this work for additional information
+@REM regarding copyright ownership. The ASF licenses this file
+@REM to you under the Apache License, Version 2.0 (the
+@REM "License"); you may not use this file except in compliance
+@REM with the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing,
+@REM software distributed under the License is distributed on an
+@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@REM KIND, either express or implied. See the License for the
+@REM specific language governing permissions and limitations
+@REM under the License.
+@REM
+
+@echo off
+echo ````````````````````````````````````````````````
+echo Starting IoTDB Client Import Script
+echo ````````````````````````````````````````````````
+
+if "%OS%" == "Windows_NT" setlocal
+
+pushd %~dp0..
+if NOT DEFINED IOTDB_CLI_HOME set IOTDB_CLI_HOME=%CD%
+popd
+
+if NOT DEFINED MAIN_CLASS set MAIN_CLASS=org.apache.iotdb.tool.MonitorTool
+if NOT DEFINED JAVA_HOME goto :err
+
+@REM -----------------------------------------------------------------------------
+@REM JVM Opts we'll use in legacy run or installation
+set JAVA_OPTS=-ea^
+ -DIOTDB_CLI_HOME=%IOTDB_CLI_HOME%
+
+@REM ***** CLASSPATH library setting *****
+set CLASSPATH=%IOTDB_CLI_HOME%\lib\*
+
+REM -----------------------------------------------------------------------------
+
+"%JAVA_HOME%\bin\java" -DIOTDB_CLI_HOME=%IOTDB_CLI_HOME% %JAVA_OPTS% -cp %CLASSPATH% %MAIN_CLASS% %*
+
+goto finally
+
+
+:err
+echo JAVA_HOME environment variable must be set!
+pause
+
+
+@REM -----------------------------------------------------------------------------
+:finally
+
+ENDLOCAL
\ No newline at end of file
diff --git a/cli/src/assembly/resources/tools/iotdb-diagnosis.sh b/cli/src/assembly/resources/tools/iotdb-diagnosis.sh
new file mode 100644
index 0000000..a2d01c4
--- /dev/null
+++ b/cli/src/assembly/resources/tools/iotdb-diagnosis.sh
@@ -0,0 +1,53 @@
+#!/bin/sh
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+echo ------------------------------------------
+echo Starting IoTDB Client Import Script
+echo ------------------------------------------
+
+if [ -z "${IOTDB_CLI_HOME}" ]; then
+ export IOTDB_CLI_HOME="$(cd "`dirname "$0"`"/..; pwd)"
+fi
+
+if [ -n "$JAVA_HOME" ]; then
+ for java in "$JAVA_HOME"/bin/amd64/java "$JAVA_HOME"/bin/java; do
+ if [ -x "$java" ]; then
+ JAVA="$java"
+ break
+ fi
+ done
+else
+ JAVA=java
+fi
+
+if [ -z $JAVA ] ; then
+ echo Unable to find java executable. Check JAVA_HOME and PATH environment variables. > /dev/stderr
+ exit 1;
+fi
+
+CLASSPATH=""
+for f in ${IOTDB_CLI_HOME}/lib/*.jar; do
+ CLASSPATH=${CLASSPATH}":"$f
+done
+
+MAIN_CLASS=org.apache.iotdb.tool.MonitorTool
+
+"$JAVA" -DIOTDB_CLI_HOME=${IOTDB_CLI_HOME} -cp "$CLASSPATH" "$MAIN_CLASS" "$@"
+exit $?
\ No newline at end of file