@@ -32,7 +32,7 @@ if [[ $# -lt 3 ]]; then
3232fi
3333
3434BIN=$( abs_path)
35- TOP=" $( cd $BIN /../ && pwd) "
35+ TOP=" $( cd " $BIN " /../ && pwd) "
3636CONF=" $TOP /conf"
3737LIB=" $TOP /lib"
3838EXT=" $TOP /ext"
@@ -41,7 +41,7 @@ LOGS="$TOP/logs"
4141OUTPUT=${LOGS} /hugegraph-server.log
4242
4343export HUGEGRAPH_HOME=" $TOP "
44- . ${BIN} /util.sh
44+ . " ${BIN} " /util.sh
4545
4646GREMLIN_SERVER_CONF=" $1 "
4747REST_SERVER_CONF=" $2 "
@@ -58,13 +58,13 @@ elif [[ $# -eq 5 ]]; then
5858 GC_OPTION=" $5 "
5959fi
6060
61- ensure_path_writable $LOGS
62- ensure_path_writable $PLUGINS
61+ ensure_path_writable " $LOGS "
62+ ensure_path_writable " $PLUGINS "
6363
64- # The maximum and minium heap memory that service can use
64+ # The maximum and minimum heap memory that service can use
6565MAX_MEM=$(( 32 * 1024 ))
6666MIN_MEM=$(( 1 * 512 ))
67- EXPECT_JDK_VERSION=1. 8
67+ MIN_JAVA_VERSION= 8
6868
6969# Add the slf4j-log4j12 binding
7070CP=$( find -L $LIB -name ' log4j-slf4j-impl*.jar' | sort | tr ' \n' ' :' )
@@ -85,19 +85,18 @@ CP="$CP":$(find -L $PLUGINS -name '*.jar' | sort | tr '\n' ':')
8585export CLASSPATH=" ${CLASSPATH:- } :$CP "
8686
8787# Change to $BIN's parent
88- cd ${TOP}
88+ cd " ${TOP} " || exit 1 ;
8989
90- # Find Java
90+ # Find java & enable server option
9191if [ " $JAVA_HOME " = " " ]; then
9292 JAVA=" java -server"
9393else
9494 JAVA=" $JAVA_HOME /bin/java -server"
9595fi
9696
97- JAVA_VERSION=$( $JAVA -version 2>&1 | awk ' NR==1{gsub(/"/,""); print $3}' \
98- | awk -F' _' ' {print $1}' )
99- if [[ $? -ne 0 || $JAVA_VERSION < $EXPECT_JDK_VERSION ]]; then
100- echo " Please make sure that the JDK is installed and the version >= $EXPECT_JDK_VERSION " \
97+ JAVA_VERSION=$( $JAVA -version 2>&1 | head -1 | cut -d' "' -f2 | sed ' s/^1\.//' | cut -d' .' -f1)
98+ if [[ $? -ne 0 || $JAVA_VERSION -lt $MIN_JAVA_VERSION ]]; then
99+ echo " Make sure the JDK is installed and the version >= $MIN_JAVA_VERSION , current is $JAVA_VERSION " \
101100 >> ${OUTPUT}
102101 exit 1
103102fi
106105if [ " $JAVA_OPTIONS " = " " ]; then
107106 XMX=$( calc_xmx $MIN_MEM $MAX_MEM )
108107 if [ $? -ne 0 ]; then
109- echo " Failed to start HugeGraphServer, requires at least ${MIN_MEM} m free memory" \
110- >> ${OUTPUT}
108+ echo " Failed to start HugeGraphServer, requires at least ${MIN_MEM} MB free memory" >> ${OUTPUT}
111109 exit 1
112110 fi
113111 JAVA_OPTIONS=" -Xms${MIN_MEM} m -Xmx${XMX} m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${LOGS} ${USER_OPTION} "
@@ -117,7 +115,7 @@ if [ "$JAVA_OPTIONS" = "" ]; then
117115 # -Xloggc:./logs/gc.log -XX:+PrintHeapAtGC -XX:+PrintGCDetails -XX:+PrintGCDateStamps"
118116fi
119117
120- if [[ $JAVA_VERSION > " 1.9 " ]]; then
118+ if [[ $JAVA_VERSION -gt 9 ]]; then
121119 JAVA_OPTIONS=" ${JAVA_OPTIONS} --add-exports=java.base/jdk.internal.reflect=ALL-UNNAMED \
122120 --add-modules=jdk.unsupported \
123121 --add-exports=java.base/sun.nio.ch=ALL-UNNAMED "
0 commit comments