This is an automated email from the ASF dual-hosted git repository.

jin pushed a commit to branch pd-store
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph.git

commit 4ad54181b4b990c3f10f75b18b050c1951cbd3e1
Author: Dandelion <[email protected]>
AuthorDate: Fri Sep 8 22:07:57 2023 +0800

    fix(dist): avoid var PRELOAD cover environmnet vars (#2302)
    
    Update hugegraph-dist/src/assembly/static/bin/start-hugegraph.sh
    
    ---------
    
    Co-authored-by: imbajin <[email protected]>
---
 .../src/assembly/static/bin/start-hugegraph.sh     | 54 +++++++++-------------
 .../hugegraph-dist/src/assembly/static/bin/util.sh |  5 ++
 2 files changed, 28 insertions(+), 31 deletions(-)

diff --git 
a/hugegraph-server/hugegraph-dist/src/assembly/static/bin/start-hugegraph.sh 
b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/start-hugegraph.sh
index c53df91b9..9ad7da8fa 100644
--- a/hugegraph-server/hugegraph-dist/src/assembly/static/bin/start-hugegraph.sh
+++ b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/start-hugegraph.sh
@@ -18,11 +18,29 @@
 OPEN_MONITOR="false"
 OPEN_SECURITY_CHECK="true"
 DAEMON="true"
-PRELOAD="false"
 #VERBOSE=""
 GC_OPTION=""
 USER_OPTION=""
 SERVER_STARTUP_TIMEOUT_S=30
+# todo: move abs_path funtion to shell like util.sh
+function abs_path() {
+    SOURCE="${BASH_SOURCE[0]}"
+    while [[ -h "$SOURCE" ]]; do
+        DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
+        SOURCE="$(readlink "$SOURCE")"
+        [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
+    done
+    cd -P "$(dirname "$SOURCE")" && pwd
+}
+
+BIN=$(abs_path)
+TOP="$(cd "$BIN"/../ && pwd)"
+CONF="$TOP/conf"
+LOGS="$TOP/logs"
+SCRIPTS="$TOP/scripts"
+PID_FILE="$BIN/pid"
+
+. "$BIN"/util.sh
 
 while getopts "d:g:m:p:s:j:t:v" arg; do
     case ${arg} in
@@ -35,45 +53,19 @@ while getopts "d:g:m:p:s:j:t:v" arg; do
         t) SERVER_STARTUP_TIMEOUT_S="$OPTARG" ;;
         # TODO: should remove it in future (check the usage carefully)
         v) VERBOSE="verbose" ;;
-        ?) echo "USAGE: $0 [-d true|false] [-g g1] [-m true|false] [-p 
true|false] [-s true|false] [-j java_options]
-                [-t timeout]" && exit 1 ;;
+        # Note: update usage info when the params changed
+        ?) exit_with_usage_help ;;
     esac
 done
 
 if [[ "$OPEN_MONITOR" != "true" && "$OPEN_MONITOR" != "false" ]]; then
-    echo "USAGE: $0 [-d true|false] [-g g1] [-m true|false] [-p true|false] 
[-s true|false] [-j java_options]"
-    exit 1
+    exit_with_usage_help
 fi
 
 if [[ "$OPEN_SECURITY_CHECK" != "true" && "$OPEN_SECURITY_CHECK" != "false" 
]]; then
-    echo "USAGE: $0 [-d true|false] [-g g1] [-m true|false] [-p true|false] 
[-s true|false] [-j java_options]"
-    exit 1
-fi
-
-if [[ "$PRELOAD" != "true" && "$PRELOAD" != "false" ]]; then
-    echo "USAGE: $0 [-d true|false] [-g g1] [-m true|false] [-p true|false] 
[-s true|false] [-j java_options]"
-    exit 1
+    exit_with_usage_help
 fi
 
-function abs_path() {
-    SOURCE="${BASH_SOURCE[0]}"
-    while [[ -h "$SOURCE" ]]; do
-        DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
-        SOURCE="$(readlink "$SOURCE")"
-        [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
-    done
-    cd -P "$(dirname "$SOURCE")" && pwd
-}
-
-BIN=$(abs_path)
-TOP="$(cd "$BIN"/../ && pwd)"
-CONF="$TOP/conf"
-LOGS="$TOP/logs"
-SCRIPTS="$TOP/scripts"
-PID_FILE="$BIN/pid"
-
-. "$BIN"/util.sh
-
 GREMLIN_SERVER_URL=$(read_property "$CONF/rest-server.properties" 
"gremlinserver.url")
 if [ -z "$GREMLIN_SERVER_URL" ]; then
     GREMLIN_SERVER_URL="http://127.0.0.1:8182";
diff --git a/hugegraph-server/hugegraph-dist/src/assembly/static/bin/util.sh 
b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/util.sh
index d03083388..64980403b 100755
--- a/hugegraph-server/hugegraph-dist/src/assembly/static/bin/util.sh
+++ b/hugegraph-server/hugegraph-dist/src/assembly/static/bin/util.sh
@@ -368,3 +368,8 @@ function kill_process_and_wait() {
     kill_process "$process_name" "$pid"
     wait_for_shutdown "$process_name" "$pid" "$timeout_s"
 }
+
+function exit_with_usage_help(){
+    echo "USAGE: $0 [-d true|false] [-g g1] [-m true|false] [-p true|false] 
[-s true|false] [-j java_options] [-t timeout]"
+    exit 1
+}

Reply via email to