From 3ea6b2481e06150e01499066c22e06c4654c5c4d Mon Sep 17 00:00:00 2001 From: icefox Date: Thu, 18 Nov 2021 16:15:48 +0800 Subject: [PATCH 01/10] optimize start.sh ,support different jdk configure JAVA_OPTS parameter optimize start.sh ,support different jdk configure JAVA_OPTS parameter --- .../src/main/resources/bin/start.sh | 12 +++++++++++- .../src/main/resources/bin/start.sh | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/shenyu-dist/shenyu-admin-dist/src/main/resources/bin/start.sh b/shenyu-dist/shenyu-admin-dist/src/main/resources/bin/start.sh index cdec70f7621d..4dfd89f6a54e 100644 --- a/shenyu-dist/shenyu-admin-dist/src/main/resources/bin/start.sh +++ b/shenyu-dist/shenyu-admin-dist/src/main/resources/bin/start.sh @@ -38,7 +38,17 @@ if [ -n "$PIDS" ]; then fi CLASS_PATH=.:${DEPLOY_DIR}/conf:${DEPLOY_DIR}/lib/*:${EXT_LIB}/* -JAVA_OPTS=" -server -Xmx2g -Xms2g -Xmn1g -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 " +JAVA_OPTS=" -server -Xmx2g -Xms2g -Xmn1g -Xss256k -XX:+DisableExplicitGC -XX:LargePageSizeInBytes=128m" + +version=`java -version 2>&1 | sed '1!d' | sed -e 's/"//g' | awk '{print $3}'` +echo "current jdk version:${version}" +if [[ "$version" =~ "1.8" ]];then +JAVA_OPTS="${JAVA_OPTS} -XX:+UseFastAccessorMethods -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70" +elif [[ "$version" =~ "11" ]];then +JAVA_OPTS="${JAVA_OPTS}" +elif [[ "$version" =~ "17" ]];then +JAVA_OPTS="${JAVA_OPTS}" +fi MAIN_CLASS=org.apache.shenyu.admin.ShenyuAdminBootstrap echo "Starting the $SERVER_NAME ..." diff --git a/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/start.sh b/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/start.sh index 5b08cbddf9f8..f38b05d0384e 100644 --- a/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/start.sh +++ b/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/start.sh @@ -38,7 +38,17 @@ if [ -n "$PIDS" ]; then fi CLASS_PATH=.:${DEPLOY_DIR}/conf:${DEPLOY_DIR}/lib/*:${EXT_LIB}/* -JAVA_OPTS=" -server -Xmx2g -Xms2g -Xmn1g -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 " +JAVA_OPTS=" -server -Xmx2g -Xms2g -Xmn1g -Xss256k -XX:+DisableExplicitGC -XX:LargePageSizeInBytes=128m" + +version=`java -version 2>&1 | sed '1!d' | sed -e 's/"//g' | awk '{print $3}'` +echo "current jdk version:${version}" +if [[ "$version" =~ "1.8" ]];then +JAVA_OPTS="${JAVA_OPTS} -XX:+UseFastAccessorMethods -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70" +elif [[ "$version" =~ "11" ]];then +JAVA_OPTS="${JAVA_OPTS}" +elif [[ "$version" =~ "17" ]];then +JAVA_OPTS="${JAVA_OPTS}" +fi MAIN_CLASS=org.apache.shenyu.bootstrap.ShenyuBootstrapApplication echo "Starting the $SERVER_NAME ..." From bffe390a2726afdbd34d52687f0f4ee49619bf88 Mon Sep 17 00:00:00 2001 From: icefox Date: Thu, 18 Nov 2021 19:18:53 +0800 Subject: [PATCH 02/10] fix start.bat ,support different JDK work and logs dir --- .../src/main/resources/bin/start.bat | 79 +++++++++++-------- .../src/main/resources/bin/start.bat | 16 +++- 2 files changed, 59 insertions(+), 36 deletions(-) diff --git a/shenyu-dist/shenyu-admin-dist/src/main/resources/bin/start.bat b/shenyu-dist/shenyu-admin-dist/src/main/resources/bin/start.bat index 0a32af82a3ec..004b23a480fc 100644 --- a/shenyu-dist/shenyu-admin-dist/src/main/resources/bin/start.bat +++ b/shenyu-dist/shenyu-admin-dist/src/main/resources/bin/start.bat @@ -1,34 +1,45 @@ -@rem -@rem Licensed to the Apache Software Foundation (ASF) under one or more -@rem contributor license agreements. See the NOTICE file distributed with -@rem this work for additional information regarding copyright ownership. -@rem The ASF licenses this file to You under the Apache License, Version 2.0 -@rem (the "License"); you may not use this file except in compliance with -@rem the License. You may obtain a copy of the License at -@rem -@rem http://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@echo off & setlocal enabledelayedexpansion - -cd %~dp0 - -set SERVER_NAME=ShenYu-Admin - -set CLASS_PATH=".;..\conf;..\lib\*;..\ext-lib\*" - -set JAVA_OPTS=-server -Xmx2g -Xms2g -Xmn1g -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 - -set MAIN_CLASS=org.apache.shenyu.admin.ShenyuAdminBootstrap - -echo Starting the %SERVER_NAME% ... - -java %JAVA_OPTS% -Dfile.encoding=UTF-8 -classpath %CLASS_PATH% %MAIN_CLASS% - -pause +@rem +@rem Licensed to the Apache Software Foundation (ASF) under one or more +@rem contributor license agreements. See the NOTICE file distributed with +@rem this work for additional information regarding copyright ownership. +@rem The ASF licenses this file to You under the Apache License, Version 2.0 +@rem (the "License"); you may not use this file except in compliance with +@rem the License. You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@echo off & setlocal enabledelayedexpansion + +cd %~dp0 + +set LOG_HOME=%~dp0/../logs + +set SERVER_NAME=ShenYu-Admin + +set CLASS_PATH=".;..\conf;..\lib\*;..\ext-lib\*" + +set JAVA_OPTS=-server -Xmx2g -Xms2g -Xmn1g -Xss256k -XX:+DisableExplicitGC -XX:LargePageSizeInBytes=128m +for /f tokens^=2-5^ delims^=^" %%j in ('java -fullversion 2^>^&1') do set "version=%%j" +echo %version%| findstr "^1.8" >nul && ( + set "JAVA_OPTS=%JAVA_OPTS% -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70" +) +echo %version%| findstr "^11" >nul && ( + set "JAVA_OPTS=%JAVA_OPTS% +) +echo %version%| findstr "^17" >nul && ( + set "JAVA_OPTS=%JAVA_OPTS% +) +set MAIN_CLASS=org.apache.shenyu.admin.ShenyuAdminBootstrap + +echo Starting the %SERVER_NAME% ... + +java %JAVA_OPTS% -Dfile.encoding=UTF-8 -Dlog.home=%LOG_HOME% -classpath %CLASS_PATH% %MAIN_CLASS% + +pause diff --git a/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/start.bat b/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/start.bat index f96c96141674..6f37da311f24 100644 --- a/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/start.bat +++ b/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/start.bat @@ -19,16 +19,28 @@ cd %~dp0 +set LOG_HOME=%~dp0/../logs + set SERVER_NAME=ShenYu-Bootstrap set CLASS_PATH=".;..\conf;..\lib\*;..\ext-lib\*" -set JAVA_OPTS=-server -Xmx2g -Xms2g -Xmn1g -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70 +set JAVA_OPTS=-server -Xmx2g -Xms2g -Xmn1g -Xss256k -XX:+DisableExplicitGC -XX:LargePageSizeInBytes=128m +for /f tokens^=2-5^ delims^=^" %%j in ('java -fullversion 2^>^&1') do set "version=%%j" +echo %version%| findstr "^1.8" >nul && ( + set "JAVA_OPTS=%JAVA_OPTS% -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70" +) +echo %version%| findstr "^11" >nul && ( + set "JAVA_OPTS=%JAVA_OPTS% +) +echo %version%| findstr "^17" >nul && ( + set "JAVA_OPTS=%JAVA_OPTS% +) set MAIN_CLASS=org.apache.shenyu.bootstrap.ShenyuBootstrapApplication echo Starting the %SERVER_NAME% ... -java %JAVA_OPTS% -Dfile.encoding=UTF-8 -classpath %CLASS_PATH% %MAIN_CLASS% +java %JAVA_OPTS% -Dfile.encoding=UTF-8 -Dlog.home=%LOG_HOME% -classpath %CLASS_PATH% %MAIN_CLASS% pause From 6912fa2fcfe6d7611e5ad43905bd0f80e0e5136a Mon Sep 17 00:00:00 2001 From: icefox Date: Thu, 18 Nov 2021 19:19:19 +0800 Subject: [PATCH 03/10] Update start.bat --- shenyu-dist/shenyu-admin-dist/src/main/resources/bin/start.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/shenyu-dist/shenyu-admin-dist/src/main/resources/bin/start.bat b/shenyu-dist/shenyu-admin-dist/src/main/resources/bin/start.bat index 004b23a480fc..bb208573825e 100644 --- a/shenyu-dist/shenyu-admin-dist/src/main/resources/bin/start.bat +++ b/shenyu-dist/shenyu-admin-dist/src/main/resources/bin/start.bat @@ -36,6 +36,7 @@ echo %version%| findstr "^11" >nul && ( echo %version%| findstr "^17" >nul && ( set "JAVA_OPTS=%JAVA_OPTS% ) + set MAIN_CLASS=org.apache.shenyu.admin.ShenyuAdminBootstrap echo Starting the %SERVER_NAME% ... From cf002c93be6655b85dfc3fd9c395b7bfbe3999eb Mon Sep 17 00:00:00 2001 From: icefox Date: Wed, 26 Jan 2022 23:20:43 +0800 Subject: [PATCH 04/10] fix start.bat(ISSUE#2814) fix start.bat [shenyu-bootstrap-dist missing agent parameter in start.bat script (Issue #2814)] --- .../src/main/resources/bin/start.bat | 104 ++++++++++-------- 1 file changed, 58 insertions(+), 46 deletions(-) diff --git a/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/start.bat b/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/start.bat index 6f37da311f24..cf82f13e51cf 100644 --- a/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/start.bat +++ b/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/start.bat @@ -1,46 +1,58 @@ -@rem -@rem Licensed to the Apache Software Foundation (ASF) under one or more -@rem contributor license agreements. See the NOTICE file distributed with -@rem this work for additional information regarding copyright ownership. -@rem The ASF licenses this file to You under the Apache License, Version 2.0 -@rem (the "License"); you may not use this file except in compliance with -@rem the License. You may obtain a copy of the License at -@rem -@rem http://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@echo off & setlocal enabledelayedexpansion - -cd %~dp0 - -set LOG_HOME=%~dp0/../logs - -set SERVER_NAME=ShenYu-Bootstrap - -set CLASS_PATH=".;..\conf;..\lib\*;..\ext-lib\*" - -set JAVA_OPTS=-server -Xmx2g -Xms2g -Xmn1g -Xss256k -XX:+DisableExplicitGC -XX:LargePageSizeInBytes=128m -for /f tokens^=2-5^ delims^=^" %%j in ('java -fullversion 2^>^&1') do set "version=%%j" -echo %version%| findstr "^1.8" >nul && ( - set "JAVA_OPTS=%JAVA_OPTS% -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70" -) -echo %version%| findstr "^11" >nul && ( - set "JAVA_OPTS=%JAVA_OPTS% -) -echo %version%| findstr "^17" >nul && ( - set "JAVA_OPTS=%JAVA_OPTS% -) - -set MAIN_CLASS=org.apache.shenyu.bootstrap.ShenyuBootstrapApplication - -echo Starting the %SERVER_NAME% ... - -java %JAVA_OPTS% -Dfile.encoding=UTF-8 -Dlog.home=%LOG_HOME% -classpath %CLASS_PATH% %MAIN_CLASS% - -pause +@rem +@rem Licensed to the Apache Software Foundation (ASF) under one or more +@rem contributor license agreements. See the NOTICE file distributed with +@rem this work for additional information regarding copyright ownership. +@rem The ASF licenses this file to You under the Apache License, Version 2.0 +@rem (the "License"); you may not use this file except in compliance with +@rem the License. You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@echo off & setlocal enabledelayedexpansion + +cd %~dp0 +set BASE_DIR=%~dp0 +set BASE_DIR=%BASE_DIR:~0,-5% + +set LOG_HOME=%BASE_DIR%/logs +set SERVER_NAME=ShenYu-Bootstrap + +set CLASS_PATH=".;..\conf;..\lib\*;..\ext-lib\*" + +set JAVA_OPTS=-server -Xmx2g -Xms2g -Xmn1g -Xss256k -XX:+DisableExplicitGC -XX:LargePageSizeInBytes=128m +for /f tokens^=2-5^ delims^=^" %%j in ('java -fullversion 2^>^&1') do set "version=%%j" +echo %version%| findstr "^1.8" >nul && ( + set "JAVA_OPTS=%JAVA_OPTS% -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70" +) +echo %version%| findstr "^11" >nul && ( + set "JAVA_OPTS=%JAVA_OPTS%" +) +echo %version%| findstr "^17" >nul && ( + set "JAVA_OPTS=%JAVA_OPTS%" +) + +set MAIN_CLASS=org.apache.shenyu.bootstrap.ShenyuBootstrapApplication + +echo current jdk version:%version% + +set AGENT=%1% + +set "SHENYU_AGENT=-javaagent:%BASE_DIR%\agent\shenyu-agent.jar" + +if "%AGENT%"=="agent" ( + echo Starting the %SERVER_NAME% with shenyu-agent ... + java %JAVA_OPTS% %SHENYU_AGENT% -Dfile.encoding=UTF-8 -Dlog.home=%LOG_HOME% -classpath %CLASS_PATH% %MAIN_CLASS% + ) ^ +else ( + echo Starting the %SERVER_NAME% ... + java %JAVA_OPTS% -Dfile.encoding=UTF-8 -Dlog.home=%LOG_HOME% -classpath %CLASS_PATH% %MAIN_CLASS% +) + +pause From 513429f946231771aa97931213d84212c506bf58 Mon Sep 17 00:00:00 2001 From: icefox Date: Thu, 27 Jan 2022 12:07:00 +0800 Subject: [PATCH 05/10] Revert "fix start.bat(ISSUE#2814)" This reverts commit cf002c93be6655b85dfc3fd9c395b7bfbe3999eb. --- .../src/main/resources/bin/start.bat | 104 ++++++++---------- 1 file changed, 46 insertions(+), 58 deletions(-) diff --git a/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/start.bat b/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/start.bat index cf82f13e51cf..6f37da311f24 100644 --- a/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/start.bat +++ b/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/start.bat @@ -1,58 +1,46 @@ -@rem -@rem Licensed to the Apache Software Foundation (ASF) under one or more -@rem contributor license agreements. See the NOTICE file distributed with -@rem this work for additional information regarding copyright ownership. -@rem The ASF licenses this file to You under the Apache License, Version 2.0 -@rem (the "License"); you may not use this file except in compliance with -@rem the License. You may obtain a copy of the License at -@rem -@rem http://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@echo off & setlocal enabledelayedexpansion - -cd %~dp0 -set BASE_DIR=%~dp0 -set BASE_DIR=%BASE_DIR:~0,-5% - -set LOG_HOME=%BASE_DIR%/logs -set SERVER_NAME=ShenYu-Bootstrap - -set CLASS_PATH=".;..\conf;..\lib\*;..\ext-lib\*" - -set JAVA_OPTS=-server -Xmx2g -Xms2g -Xmn1g -Xss256k -XX:+DisableExplicitGC -XX:LargePageSizeInBytes=128m -for /f tokens^=2-5^ delims^=^" %%j in ('java -fullversion 2^>^&1') do set "version=%%j" -echo %version%| findstr "^1.8" >nul && ( - set "JAVA_OPTS=%JAVA_OPTS% -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70" -) -echo %version%| findstr "^11" >nul && ( - set "JAVA_OPTS=%JAVA_OPTS%" -) -echo %version%| findstr "^17" >nul && ( - set "JAVA_OPTS=%JAVA_OPTS%" -) - -set MAIN_CLASS=org.apache.shenyu.bootstrap.ShenyuBootstrapApplication - -echo current jdk version:%version% - -set AGENT=%1% - -set "SHENYU_AGENT=-javaagent:%BASE_DIR%\agent\shenyu-agent.jar" - -if "%AGENT%"=="agent" ( - echo Starting the %SERVER_NAME% with shenyu-agent ... - java %JAVA_OPTS% %SHENYU_AGENT% -Dfile.encoding=UTF-8 -Dlog.home=%LOG_HOME% -classpath %CLASS_PATH% %MAIN_CLASS% - ) ^ -else ( - echo Starting the %SERVER_NAME% ... - java %JAVA_OPTS% -Dfile.encoding=UTF-8 -Dlog.home=%LOG_HOME% -classpath %CLASS_PATH% %MAIN_CLASS% -) - -pause +@rem +@rem Licensed to the Apache Software Foundation (ASF) under one or more +@rem contributor license agreements. See the NOTICE file distributed with +@rem this work for additional information regarding copyright ownership. +@rem The ASF licenses this file to You under the Apache License, Version 2.0 +@rem (the "License"); you may not use this file except in compliance with +@rem the License. You may obtain a copy of the License at +@rem +@rem http://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@echo off & setlocal enabledelayedexpansion + +cd %~dp0 + +set LOG_HOME=%~dp0/../logs + +set SERVER_NAME=ShenYu-Bootstrap + +set CLASS_PATH=".;..\conf;..\lib\*;..\ext-lib\*" + +set JAVA_OPTS=-server -Xmx2g -Xms2g -Xmn1g -Xss256k -XX:+DisableExplicitGC -XX:LargePageSizeInBytes=128m +for /f tokens^=2-5^ delims^=^" %%j in ('java -fullversion 2^>^&1') do set "version=%%j" +echo %version%| findstr "^1.8" >nul && ( + set "JAVA_OPTS=%JAVA_OPTS% -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70" +) +echo %version%| findstr "^11" >nul && ( + set "JAVA_OPTS=%JAVA_OPTS% +) +echo %version%| findstr "^17" >nul && ( + set "JAVA_OPTS=%JAVA_OPTS% +) + +set MAIN_CLASS=org.apache.shenyu.bootstrap.ShenyuBootstrapApplication + +echo Starting the %SERVER_NAME% ... + +java %JAVA_OPTS% -Dfile.encoding=UTF-8 -Dlog.home=%LOG_HOME% -classpath %CLASS_PATH% %MAIN_CLASS% + +pause From 6be8b00aa8ba18e6d3957f134766b63b4b27b47a Mon Sep 17 00:00:00 2001 From: icefox Date: Thu, 27 Jan 2022 12:22:15 +0800 Subject: [PATCH 06/10] fix start.bat (Issue #2814) --- .../src/main/resources/bin/start.bat | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/start.bat b/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/start.bat index 6f37da311f24..647676c49cfc 100644 --- a/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/start.bat +++ b/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/start.bat @@ -31,16 +31,24 @@ echo %version%| findstr "^1.8" >nul && ( set "JAVA_OPTS=%JAVA_OPTS% -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70" ) echo %version%| findstr "^11" >nul && ( - set "JAVA_OPTS=%JAVA_OPTS% + set "JAVA_OPTS=%JAVA_OPTS%" ) echo %version%| findstr "^17" >nul && ( - set "JAVA_OPTS=%JAVA_OPTS% + set "JAVA_OPTS=%JAVA_OPTS%" ) set MAIN_CLASS=org.apache.shenyu.bootstrap.ShenyuBootstrapApplication -echo Starting the %SERVER_NAME% ... +set AGENT=%1% -java %JAVA_OPTS% -Dfile.encoding=UTF-8 -Dlog.home=%LOG_HOME% -classpath %CLASS_PATH% %MAIN_CLASS% +set "SHENYU_AGENT=-javaagent:%~dp0/../agent/shenyu-agent.jar" +if "%AGENT%"=="agent" ( + echo Starting the %SERVER_NAME% with shenyu-agent ... + java %JAVA_OPTS% %SHENYU_AGENT% -Dfile.encoding=UTF-8 -Dlog.home=%LOG_HOME% -classpath %CLASS_PATH% %MAIN_CLASS% + ) ^ +else ( + echo Starting the %SERVER_NAME% ... + java %JAVA_OPTS% -Dfile.encoding=UTF-8 -Dlog.home=%LOG_HOME% -classpath %CLASS_PATH% %MAIN_CLASS% +) pause From bd0bd3a5a1d237d804c7fdf06f32da88d951c59b Mon Sep 17 00:00:00 2001 From: icefox Date: Thu, 27 Jan 2022 12:25:24 +0800 Subject: [PATCH 07/10] Update start.bat --- .../shenyu-bootstrap-dist/src/main/resources/bin/start.bat | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/start.bat b/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/start.bat index 647676c49cfc..86954491f6c2 100644 --- a/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/start.bat +++ b/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/start.bat @@ -28,13 +28,13 @@ set CLASS_PATH=".;..\conf;..\lib\*;..\ext-lib\*" set JAVA_OPTS=-server -Xmx2g -Xms2g -Xmn1g -Xss256k -XX:+DisableExplicitGC -XX:LargePageSizeInBytes=128m for /f tokens^=2-5^ delims^=^" %%j in ('java -fullversion 2^>^&1') do set "version=%%j" echo %version%| findstr "^1.8" >nul && ( - set "JAVA_OPTS=%JAVA_OPTS% -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70" + set "JAVA_OPTS=%JAVA_OPTS% -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70" ) echo %version%| findstr "^11" >nul && ( - set "JAVA_OPTS=%JAVA_OPTS%" + set "JAVA_OPTS=%JAVA_OPTS%" ) echo %version%| findstr "^17" >nul && ( - set "JAVA_OPTS=%JAVA_OPTS%" + set "JAVA_OPTS=%JAVA_OPTS%" ) set MAIN_CLASS=org.apache.shenyu.bootstrap.ShenyuBootstrapApplication From 562d733130b655251a334fc2888ee4a99348a3e4 Mon Sep 17 00:00:00 2001 From: icefox Date: Sun, 3 Apr 2022 00:19:25 +0800 Subject: [PATCH 08/10] fix stop.sh exxcute failed in macos --- shenyu-dist/shenyu-admin-dist/src/main/resources/bin/stop.sh | 2 +- .../shenyu-bootstrap-dist/src/main/resources/bin/stop.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/shenyu-dist/shenyu-admin-dist/src/main/resources/bin/stop.sh b/shenyu-dist/shenyu-admin-dist/src/main/resources/bin/stop.sh index b73da86fd52e..3a43b43ce500 100644 --- a/shenyu-dist/shenyu-admin-dist/src/main/resources/bin/stop.sh +++ b/shenyu-dist/shenyu-admin-dist/src/main/resources/bin/stop.sh @@ -22,7 +22,7 @@ cd `dirname $0` cd .. DEPLOY_DIR=`pwd` -PIDS=`ps -eo pid,cmd |grep -v tail|grep -v grep|grep "$DEPLOY_DIR"|awk '{print $1}'` +PIDS=`ps ax |grep -v tail|grep -v grep|grep "$DEPLOY_DIR"|awk '{print $1}'` if [ -z "$PIDS" ]; then echo "ERROR: The $SERVER_NAME does not started!" exit 1 diff --git a/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/stop.sh b/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/stop.sh index ca02bdd3eaa3..ad8511f83351 100644 --- a/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/stop.sh +++ b/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/stop.sh @@ -22,7 +22,7 @@ cd `dirname $0` cd .. DEPLOY_DIR=`pwd` -PIDS=`ps -eo pid,cmd |grep -v tail|grep -v grep|grep "$DEPLOY_DIR"|awk '{print $1}'` +PIDS=`ps ax |grep -v tail|grep -v grep|grep "$DEPLOY_DIR"|awk '{print $1}'` if [ -z "$PIDS" ]; then echo "ERROR: The $SERVER_NAME does not started!" exit 1 From 5ecc78c866e5c6e34ef5f66b3a2b6a0aca4c2239 Mon Sep 17 00:00:00 2001 From: icefox Date: Sun, 3 Apr 2022 00:26:15 +0800 Subject: [PATCH 09/10] fix stop.sh execute failed in macos (#3187) --- shenyu-dist/shenyu-admin-dist/src/main/resources/bin/stop.sh | 2 +- .../shenyu-bootstrap-dist/src/main/resources/bin/stop.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/shenyu-dist/shenyu-admin-dist/src/main/resources/bin/stop.sh b/shenyu-dist/shenyu-admin-dist/src/main/resources/bin/stop.sh index 3a43b43ce500..b73da86fd52e 100644 --- a/shenyu-dist/shenyu-admin-dist/src/main/resources/bin/stop.sh +++ b/shenyu-dist/shenyu-admin-dist/src/main/resources/bin/stop.sh @@ -22,7 +22,7 @@ cd `dirname $0` cd .. DEPLOY_DIR=`pwd` -PIDS=`ps ax |grep -v tail|grep -v grep|grep "$DEPLOY_DIR"|awk '{print $1}'` +PIDS=`ps -eo pid,cmd |grep -v tail|grep -v grep|grep "$DEPLOY_DIR"|awk '{print $1}'` if [ -z "$PIDS" ]; then echo "ERROR: The $SERVER_NAME does not started!" exit 1 diff --git a/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/stop.sh b/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/stop.sh index ad8511f83351..ca02bdd3eaa3 100644 --- a/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/stop.sh +++ b/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/stop.sh @@ -22,7 +22,7 @@ cd `dirname $0` cd .. DEPLOY_DIR=`pwd` -PIDS=`ps ax |grep -v tail|grep -v grep|grep "$DEPLOY_DIR"|awk '{print $1}'` +PIDS=`ps -eo pid,cmd |grep -v tail|grep -v grep|grep "$DEPLOY_DIR"|awk '{print $1}'` if [ -z "$PIDS" ]; then echo "ERROR: The $SERVER_NAME does not started!" exit 1 From a4934b9b2e61367ecad32511ecd01f21cefeb4e8 Mon Sep 17 00:00:00 2001 From: icefox Date: Sun, 3 Apr 2022 00:29:55 +0800 Subject: [PATCH 10/10] fix stop.sh execute failed in macos (#3187) --- shenyu-dist/shenyu-admin-dist/src/main/resources/bin/stop.sh | 2 +- .../shenyu-bootstrap-dist/src/main/resources/bin/stop.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/shenyu-dist/shenyu-admin-dist/src/main/resources/bin/stop.sh b/shenyu-dist/shenyu-admin-dist/src/main/resources/bin/stop.sh index b73da86fd52e..3a43b43ce500 100644 --- a/shenyu-dist/shenyu-admin-dist/src/main/resources/bin/stop.sh +++ b/shenyu-dist/shenyu-admin-dist/src/main/resources/bin/stop.sh @@ -22,7 +22,7 @@ cd `dirname $0` cd .. DEPLOY_DIR=`pwd` -PIDS=`ps -eo pid,cmd |grep -v tail|grep -v grep|grep "$DEPLOY_DIR"|awk '{print $1}'` +PIDS=`ps ax |grep -v tail|grep -v grep|grep "$DEPLOY_DIR"|awk '{print $1}'` if [ -z "$PIDS" ]; then echo "ERROR: The $SERVER_NAME does not started!" exit 1 diff --git a/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/stop.sh b/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/stop.sh index ca02bdd3eaa3..ad8511f83351 100644 --- a/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/stop.sh +++ b/shenyu-dist/shenyu-bootstrap-dist/src/main/resources/bin/stop.sh @@ -22,7 +22,7 @@ cd `dirname $0` cd .. DEPLOY_DIR=`pwd` -PIDS=`ps -eo pid,cmd |grep -v tail|grep -v grep|grep "$DEPLOY_DIR"|awk '{print $1}'` +PIDS=`ps ax |grep -v tail|grep -v grep|grep "$DEPLOY_DIR"|awk '{print $1}'` if [ -z "$PIDS" ]; then echo "ERROR: The $SERVER_NAME does not started!" exit 1