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:22:02 UTC

start.sh script problem

JAVA_OPTS does not take effect in the start.sh script

Re: start.sh script problem

Posted by Zhang Yonglun <zh...@apache.org>.
Hi Junjie,

The mail list can not show graphs. Please put the text about the problem.

--

Zhang Yonglun
Apache ShenYu (Incubating)
Apache ShardingSphere


吴俊杰 <29...@qq.com> 于2021年5月14日周五 下午2:22写道:

> 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
>
>
>
>
>
>

回复:start.sh script problem

Posted by 吴俊杰 <29...@qq.com>.
The adjusted script is as follows :&nbsp;


#!/bin/bash


# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.&nbsp; See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.&nbsp; 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.&nbsp; You may obtain a copy of the License at
#
#&nbsp; &nbsp; &nbsp;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" ]] &amp;&amp; [[ -x "$JAVA_HOME/bin/java" ]];&nbsp; then
&nbsp; &nbsp; JAVA="$JAVA_HOME/bin/java"
elif type -p java; then
&nbsp; &nbsp; JAVA=java
else
&nbsp; &nbsp; echo "Error: JAVA_HOME environment variable is not set." 1&gt;&amp;2
&nbsp; &nbsp; 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" ]] &amp;&amp; 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="
&nbsp; -XX:+UseParNewGC \
&nbsp; -XX:+UseConcMarkSweepGC \
&nbsp; -XX:+CMSParallelRemarkEnabled \
&nbsp; -XX:+UseCMSInitiatingOccupancyOnly \
&nbsp; -XX:MaxGCPauseMillis=850 \
&nbsp; -XX:ParallelGCThreads=20 \
&nbsp; -XX:CMSInitiatingOccupancyFraction=75 \
&nbsp; -XX:+AggressiveOpts \
&nbsp; -XX:+UseBiasedLocking \
&nbsp; -XX:+DisableExplicitGC \
&nbsp; -XX:+UseFastAccessorMethods \
&nbsp; -XX:+HeapDumpOnOutOfMemoryError \
&nbsp; "
#&nbsp; -XX:+PrintGCDetail
#&nbsp; -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" &gt;&gt; "${LOG_DIR}"/shenyu-bootstrap.out &amp;
$JAVA $JAVA_OPTS -jar $APP --spring.config.location=file:"$BASE_DIR"/conf/&nbsp; &gt;&gt; "${LOG_DIR}"/soul-bootstrap.out 2&gt;&amp;1 &amp;


if [ $? -gt 0 ]; then
&nbsp; &nbsp; echo "Starting $APP ERROR"
fi
&nbsp; &nbsp; echo "Starting $APP OK"
echo $! &gt; "$PID_FILE"









------------------&nbsp;原始邮件&nbsp;------------------
发件人:                                                                                                                        "吴俊杰"                                                                                    <296858130@qq.com&gt;;
发送时间:&nbsp;2021年5月14日(星期五) 下午2:22
收件人:&nbsp;"dev"<dev@shenyu.apache.org&gt;;

主题:&nbsp;start.sh script problem



JAVA_OPTS does not take effect in the start.sh script