From d2267d7bf3f1d3a88d8d626a1b73d2527910c262 Mon Sep 17 00:00:00 2001 From: brotherlu-xcq <1285823170@qq.com> Date: Fri, 27 Aug 2021 09:33:47 +0800 Subject: [PATCH] [ISSUE #6609] fix the startup.sh problem. (#6739) * [ISSUE #6737] fix the shell issue. * [ISSUE #6737] fix the shell issue. --- distribution/bin/startup.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/distribution/bin/startup.sh b/distribution/bin/startup.sh index b836a7377..2a3a16538 100644 --- a/distribution/bin/startup.sh +++ b/distribution/bin/startup.sh @@ -108,7 +108,7 @@ JAVA_MAJOR_VERSION=$($JAVA -version 2>&1 | sed -E -n 's/.* version "([0-9]*).*$/ if [[ "$JAVA_MAJOR_VERSION" -ge "9" ]] ; then JAVA_OPT="${JAVA_OPT} -Xlog:gc*:file=${BASE_DIR}/logs/nacos_gc.log:time,tags:filecount=10,filesize=102400" else - JAVA ="${JAVA} -Djava.ext.dirs=${JAVA_HOME}/jre/lib/ext:${JAVA_HOME}/lib/ext" + JAVA_OPT_EXT_FIX="-Djava.ext.dirs=${JAVA_HOME}/jre/lib/ext:${JAVA_HOME}/lib/ext" 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 @@ -124,7 +124,7 @@ if [ ! -d "${BASE_DIR}/logs" ]; then mkdir ${BASE_DIR}/logs fi -echo "$JAVA ${JAVA_OPT}" +echo "$JAVA $JAVA_OPT_EXT_FIX ${JAVA_OPT}" if [[ "${MODE}" == "standalone" ]]; then echo "nacos is starting with standalone" @@ -137,6 +137,12 @@ if [ ! -f "${BASE_DIR}/logs/start.out" ]; then touch "${BASE_DIR}/logs/start.out" fi # start -echo "$JAVA ${JAVA_OPT}" > ${BASE_DIR}/logs/start.out 2>&1 & -nohup "$JAVA" ${JAVA_OPT} nacos.nacos >> ${BASE_DIR}/logs/start.out 2>&1 & +echo "$JAVA $JAVA_OPT_EXT_FIX ${JAVA_OPT}" > ${BASE_DIR}/logs/start.out 2>&1 & + +if [[ "$JAVA_OPT_EXT_FIX" == "" ]]; then + nohup "$JAVA" ${JAVA_OPT} nacos.nacos >> ${BASE_DIR}/logs/start.out 2>&1 & +else + nohup "$JAVA" "$JAVA_OPT_EXT_FIX" ${JAVA_OPT} nacos.nacos >> ${BASE_DIR}/logs/start.out 2>&1 & +fi + echo "nacos is starting,you can check the ${BASE_DIR}/logs/start.out"