diff --git a/distribution/bin/startup.sh b/distribution/bin/startup.sh index 6d7ca517c..3ae8da859 100644 --- a/distribution/bin/startup.sh +++ b/distribution/bin/startup.sh @@ -56,23 +56,13 @@ else fi -# GC options -# The first segment of the version number, which is '1' for releases before Java 9 -# it then becomes '9', '10', ... -# Some examples of the first line of `java --version`: -# 8 -> java version "1.8.0_152" -# 9.0.4 -> java version "9.0.4" -# 10 -> java version "10" 2018-03-20 -# 10.0.1 -> java version "10.0.1" 2018-04-17 -# We need to match to the end of the line to prevent sed from printing the characters that do not match JAVA_MAJOR_VERSION=$($JAVA -version 2>&1 | sed -E -n 's/.* version "([0-9]*).*$/\1/p') if [[ "$JAVA_MAJOR_VERSION" -ge "9" ]] ; then - KAFKA_GC_LOG_OPTS="-Xlog:gc*:file=${BASE_DIR}/logs/nacos_gc.log:time,tags:filecount=10,filesize=102400" + JAVA_OPT="${JAVA_OPT} -Xlog:gc*:file=${BASE_DIR}/logs/nacos_gc.log:time,tags:filecount=10,filesize=102400" else - KAFKA_GC_LOG_OPTS="-Xloggc:${BASE_DIR}/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M" + JAVA_OPT="${JAVA_OPT} -Xloggc:${BASE_DIR}/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M" fi - JAVA_OPT="${JAVA_OPT} -Dnacos.home=${BASE_DIR}" JAVA_OPT="${JAVA_OPT} -jar ${BASE_DIR}/target/nacos-server.jar" JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}"