windows 脚本支持 -m -f 参数
This commit is contained in:
parent
71d9cb3e04
commit
9aea3ff2c4
@ -14,7 +14,7 @@ rem limitations under the License.
|
||||
if not exist "%JAVA_HOME%\bin\java.exe" echo Please set the JAVA_HOME variable in your environment, We need java(x64)! jdk8 or later is better! & EXIT /B 1
|
||||
set "JAVA=%JAVA_HOME%\bin\java.exe"
|
||||
|
||||
setlocal
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
set BASE_DIR=%~dp0
|
||||
rem added double quotation marks to avoid the issue caused by the folder names containing spaces.
|
||||
@ -24,16 +24,41 @@ set BASE_DIR="%BASE_DIR:~0,-5%"
|
||||
set DEFAULT_SEARCH_LOCATIONS="classpath:/,classpath:/config/,file:./,file:./config/"
|
||||
set CUSTOM_SEARCH_LOCATIONS=%DEFAULT_SEARCH_LOCATIONS%,file:%BASE_DIR%/conf/
|
||||
|
||||
set MODE="standalone"
|
||||
set FUNCTION_MODE="all"
|
||||
set MODE_INDEX=-1
|
||||
set FUNCTION_MODE_INDEX=-1
|
||||
|
||||
set i=0
|
||||
for %%a in (%*) do (
|
||||
if "%%a" == "-m" ( set /a MODE_INDEX=!i!+1 )
|
||||
if "%%a" == "-f" ( set /a FUNCTION_MODE_INDEX=!i!+1 )
|
||||
set /a i+=1
|
||||
)
|
||||
|
||||
if not "%2" == "cluster" (
|
||||
set i=0
|
||||
for %%a in (%*) do (
|
||||
if %MODE_INDEX% == !i! ( set MODE="%%a" )
|
||||
if %FUNCTION_MODE_INDEX% == !i! ( set FUNCTION_MODE="%%a" )
|
||||
set /a i+=1
|
||||
)
|
||||
|
||||
if %MODE% == "standalone" (
|
||||
set "JAVA_OPT=%JAVA_OPT% -Xms512m -Xmx512m -Xmn256m"
|
||||
set "JAVA_OPT=%JAVA_OPT% -Dnacos.standalone=true"
|
||||
) else (
|
||||
) else (
|
||||
set "JAVA_OPT=%JAVA_OPT% -server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
|
||||
set "JAVA_OPT=%JAVA_OPT% -XX:-OmitStackTraceInFastThrow XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=%BASE_DIR%\logs\java_heapdump.hprof"
|
||||
set "JAVA_OPT=%JAVA_OPT% -XX:-UseLargePages"
|
||||
)
|
||||
)
|
||||
|
||||
if %FUNCTION_MODE% == "config" (
|
||||
set "JAVA_OPT=%JAVA_OPT% -Dnacos.functionMode=config"
|
||||
)
|
||||
if %FUNCTION_MODE% == "naming" (
|
||||
set "JAVA_OPT=%JAVA_OPT% -Dnacos.functionMode=naming"
|
||||
)
|
||||
|
||||
|
||||
set "JAVA_OPT=%JAVA_OPT% -Xbootclasspath/a:%BASE_DIR%\plugins\cmdb"
|
||||
set "JAVA_OPT=%JAVA_OPT% -Dnacos.home=%BASE_DIR%"
|
||||
|
Loading…
Reference in New Issue
Block a user