You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shenyu.apache.org by 吴俊杰 <29...@qq.com> on 2021/05/14 06:36:25 UTC
回复:start.sh script problem
The adjusted script is as follows :
#!/bin/bash
# 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.
if [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then
JAVA="$JAVA_HOME/bin/java"
elif type -p java; then
JAVA=java
else
echo "Error: JAVA_HOME environment variable is not set." 1>&2
exit 1
fi
#PRG_DIR=$(dirname "$0")
PRG_DIR=$(cd `dirname $0`; pwd)
#APP="$PRG_DIR/../lib/shenyu-bootstrap.jar"
#BASE_DIR="$PRG_DIR/.."
BASE_DIR=$(cd $PRG_DIR/.. ; pwd)
APP="$BASE_DIR/lib/soul-bootstrap.jar"
[[ -z "$LOG_DIR" ]] && LOG_DIR="$BASE_DIR/logs"
[[ -d "$LOG_DIR" ]] || mkdir -p "$LOG_DIR"
PID_FILE="$LOG_DIR/shenyu-bootstrap.pid"
JAVA_MEM_OPTS="-Xmx2048m -Xms2048m -Xmn1024m -Xss512k"
JAVA_GC_TUNE_OPTS="
-XX:+UseParNewGC \
-XX:+UseConcMarkSweepGC \
-XX:+CMSParallelRemarkEnabled \
-XX:+UseCMSInitiatingOccupancyOnly \
-XX:MaxGCPauseMillis=850 \
-XX:ParallelGCThreads=20 \
-XX:CMSInitiatingOccupancyFraction=75 \
-XX:+AggressiveOpts \
-XX:+UseBiasedLocking \
-XX:+DisableExplicitGC \
-XX:+UseFastAccessorMethods \
-XX:+HeapDumpOnOutOfMemoryError \
"
# -XX:+PrintGCDetail
# -XX:+UseCMSCompactAtFullCollection
JAVA_GC_LOG_OPTS="-Xloggc:$LOG_DIR/gc.log"
JAVA_OPTS="$JAVA_OPTS $JAVA_MEM_OPTS $JAVA_GC_TUNE_OPTS $JAVA_GC_LOG_OPTS"
#$JAVA -jar "$APP" --spring.config.location=file:"$BASE_DIR"/conf/ "$JAVA_OPTS" >> "${LOG_DIR}"/shenyu-bootstrap.out &
$JAVA $JAVA_OPTS -jar $APP --spring.config.location=file:"$BASE_DIR"/conf/ >> "${LOG_DIR}"/soul-bootstrap.out 2>&1 &
if [ $? -gt 0 ]; then
echo "Starting $APP ERROR"
fi
echo "Starting $APP OK"
echo $! > "$PID_FILE"
------------------ 原始邮件 ------------------
发件人: "吴俊杰" <296858130@qq.com>;
发送时间: 2021年5月14日(星期五) 下午2:22
收件人: "dev"<dev@shenyu.apache.org>;
主题: start.sh script problem
JAVA_OPTS does not take effect in the start.sh script
Re: start.sh script problem
Posted by Liming Deng <de...@apache.org>.
Hi~ Junjie,
Your solution looks good. Thanks! Please feel free to submit a PR.
吴俊杰 <29...@qq.com> 于2021年5月14日周五 下午2:36写道:
> The adjusted script is as follows :
>
> #!/bin/bash
>
> # 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.
>
> if [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then
> JAVA="$JAVA_HOME/bin/java"
> elif type -p java; then
> JAVA=java
> else
> echo "Error: JAVA_HOME environment variable is not set." 1>&2
> exit 1
> fi
>
> #PRG_DIR=$(dirname "$0")
> PRG_DIR=$(cd `dirname $0`; pwd)
>
> #APP="$PRG_DIR/../lib/shenyu-bootstrap.jar"
> #BASE_DIR="$PRG_DIR/.."
>
> BASE_DIR=$(cd $PRG_DIR/.. ; pwd)
> APP="$BASE_DIR/lib/soul-bootstrap.jar"
>
> [[ -z "$LOG_DIR" ]] && LOG_DIR="$BASE_DIR/logs"
> [[ -d "$LOG_DIR" ]] || mkdir -p "$LOG_DIR"
>
> PID_FILE="$LOG_DIR/shenyu-bootstrap.pid"
>
> JAVA_MEM_OPTS="-Xmx2048m -Xms2048m -Xmn1024m -Xss512k"
>
> JAVA_GC_TUNE_OPTS="
> -XX:+UseParNewGC \
> -XX:+UseConcMarkSweepGC \
> -XX:+CMSParallelRemarkEnabled \
> -XX:+UseCMSInitiatingOccupancyOnly \
> -XX:MaxGCPauseMillis=850 \
> -XX:ParallelGCThreads=20 \
> -XX:CMSInitiatingOccupancyFraction=75 \
> -XX:+AggressiveOpts \
> -XX:+UseBiasedLocking \
> -XX:+DisableExplicitGC \
> -XX:+UseFastAccessorMethods \
> -XX:+HeapDumpOnOutOfMemoryError \
> "
> # -XX:+PrintGCDetail
> # -XX:+UseCMSCompactAtFullCollection
>
> JAVA_GC_LOG_OPTS="-Xloggc:$LOG_DIR/gc.log"
>
> JAVA_OPTS="$JAVA_OPTS $JAVA_MEM_OPTS $JAVA_GC_TUNE_OPTS $JAVA_GC_LOG_OPTS"
>
> #$JAVA -jar "$APP" --spring.config.location=file:"$BASE_DIR"/conf/
> "$JAVA_OPTS" >> "${LOG_DIR}"/shenyu-bootstrap.out &
> $JAVA $JAVA_OPTS -jar $APP
> --spring.config.location=file:"$BASE_DIR"/conf/ >>
> "${LOG_DIR}"/soul-bootstrap.out 2>&1 &
>
> if [ $? -gt 0 ]; then
> echo "Starting $APP ERROR"
> fi
> echo "Starting $APP OK"
> echo $! > "$PID_FILE"
>
>
>
>
> ------------------ 原始邮件 ------------------
> *发件人:* "吴俊杰" <29...@qq.com>;
> *发送时间:* 2021年5月14日(星期五) 下午2:22
> *收件人:* "dev"<de...@shenyu.apache.org>;
> *主题:* start.sh script problem
>
> JAVA_OPTS does not take effect in the start.sh script
>
>
>
>
>
>