diff --git a/server/eval/Resources/eval.bat b/server/eval/Resources/eval.bat index d068863..89ea08a 100644 --- a/server/eval/Resources/eval.bat +++ b/server/eval/Resources/eval.bat @@ -1,18 +1,128 @@ @echo off -chcp 65001 -title Eval Quick Start +setlocal enabledelayedexpansion +chcp 65001 >nul -cd %EVAL_MAIN% -if exist "%EVAL_MANAGE%" ( - start "Eval Server" cmd /k "java -jar %EVAL_VM_PARAMS% -jar %EVAL_MANAGE_BIN%" +set SERVER_UPPER=EVAL +set SERVER_LOWER=eval +set SERVER_HUMP=Eval +set /a SERVER_PORT=28480 +set /a WEBSITE_PORT=%SERVER_PORT%-10000 + +set modifyTitle=1 +for %%a in (%*) do ( + if /i "%%a"=="/notitle" set modifyTitle=0 ) -if exist "%EVAL_MANAGE%" ( - start "Eval Website" cmd /k "cd web && eval-web.exe -c conf/web.conf" +if %modifyTitle% equ 1 ( + title %SERVER_HUMP% Quick Start ) -echo Eval: -echo - EvalServer (Port: 28480) -echo - EvalWebsite (Port: 18480) +:: ============================================= +:: Validation +:: ============================================= +if not defined !SERVER_UPPER!_MAIN ( + echo [ERROR] !SERVER_UPPER!_MAIN environment variable is not defined + pause && exit /b 1 +) -pause \ No newline at end of file +if not defined !SERVER_UPPER!_MANAGE_BIN ( + echo [ERROR] !SERVER_UPPER!_MANAGE_BIN environment variable is not defined + pause && exit /b 1 +) + +if not defined !SERVER_UPPER!_VM_PARAMS ( + echo Warning: !SERVER_UPPER!_VM_PARAMS environment variable is not defined + set %SERVER_UPPER%_VM_PARAMS=-Xms512m -Xmx2048m +) + +cd /d "!%SERVER_UPPER%_MAIN!" 2>nul +if errorlevel 1 ( + echo [ERROR] Directory not found: !%SERVER_UPPER%_MAIN! + echo Please verify %SERVER_UPPER%_MAIN environment variable + pause && exit /b 1 +) + +if not exist "!%SERVER_UPPER%_MANAGE_BIN!" ( + echo [ERROR] Main JAR file not found: !%SERVER_UPPER%_MANAGE_BIN! + echo Please verify %SERVER_UPPER%_MANAGE_BIN environment variable + pause && exit /b 1 +) + +cd web 2>nul +if errorlevel 1 ( + echo [ERROR] web directory does not exist in !%SERVER_UPPER%_MAIN! + pause && exit /b 1 +) + +if not exist "%SERVER_LOWER%-web.exe" ( + echo [ERROR] %SERVER_LOWER%-web.exe does not exist in !%SERVER_UPPER%_MAIN!\web + pause && exit /b 1 +) + +if not exist "conf\web.conf" ( + echo [ERROR] conf\web.conf does not exist in !%SERVER_UPPER%_MAIN!\web + pause && exit /b 1 +) + +:: ============================================= +:: Service Launch +:: ============================================= +cd .. + +setlocal + +echo Starting %SERVER_HUMP% Server... +jps -v | grep "\-Dserver.port=%SERVER_PORT%" | awk "{print $1}" >server.tmp +set /p pid=nul +if defined pid ( + taskkill -f -pid !pid! +) +start "%SERVER_HUMP% Server" /B cmd /c "chcp 65001 && java !%SERVER_UPPER%_VM_PARAMS! -jar !%SERVER_UPPER%_MANAGE_BIN!" + +echo Starting %SERVER_HUMP% Website... +cd web +taskkill -f -im %SERVER_LOWER%-web.exe >nul +start "%SERVER_HUMP% Website" /B cmd /c "%SERVER_LOWER%-web.exe -c conf\web.conf" + +set MAX_WAIT=300 +set CHECK_INTERVAL=5 +set counter=0 +echo Waiting for services to start... +echo. + +:CHECK_LOOP +netstat -an | find ":%SERVER_PORT%" > nul +set server_up=%errorlevel% + +netstat -an | find ":%WEBSITE_PORT%" > nul +set website_up=%errorlevel% + +if !server_up! equ 0 if !website_up! equ 0 ( + call :DISPLAY_SUCCESS + exit /b 0 +) + +set /a counter+=CHECK_INTERVAL +if !counter! geq %MAX_WAIT% ( + echo Error: Services did not start within !counter! seconds + exit /b 1 +) + +timeout /t %CHECK_INTERVAL% /nobreak > nul +goto CHECK_LOOP + +:DISPLAY_SUCCESS +:: ============================================= +:: Status Display +:: ============================================= +echo. +echo ======================================== +echo %SERVER_HUMP% Services Successfully Started +echo ======================================== +echo - %SERVER_HUMP% Server (Port: %SERVER_PORT%) +echo - %SERVER_HUMP% Website (Port: %WEBSITE_PORT%) +echo ======================================== +echo. +endlocal +exit /b 0 \ No newline at end of file diff --git a/server/eval/install-win7-eval.iss b/server/eval/install-win7-eval.iss index 89842b0..36428d0 100644 --- a/server/eval/install-win7-eval.iss +++ b/server/eval/install-win7-eval.iss @@ -1,7 +1,7 @@ ;iss #define MyAppName "效能评估" -#define MyAppVersion "1.0.2" +#define MyAppVersion "1.0.3" #define MyAppPublisher "X" #define MyAppURL "~" #define MyAppExeName "eval" diff --git a/server/model/Resources/model.bat b/server/model/Resources/model.bat index a4292c5..a453b6b 100644 --- a/server/model/Resources/model.bat +++ b/server/model/Resources/model.bat @@ -1,18 +1,128 @@ @echo off -chcp 65001 -title Model Quick Start +setlocal enabledelayedexpansion +chcp 65001 >nul -cd %MODEL_MAIN% -if exist "%MODEL_MANAGE_BIN%" ( - start "Model Server" cmd /k "java -jar %MODEL_VM_PARAMS% -jar %MODEL_MANAGE_BIN%" +set SERVER_UPPER=MODEL +set SERVER_LOWER=model +set SERVER_HUMP=Model +set /a SERVER_PORT=28680 +set /a WEBSITE_PORT=%SERVER_PORT%-10000 + +set modifyTitle=1 +for %%a in (%*) do ( + if /i "%%a"=="/notitle" set modifyTitle=0 ) -if exist "%MODEL_MANAGE_BIN%" ( - start "Model Website" cmd /k "cd web && model-web.exe -c conf/web.conf" +if %modifyTitle% equ 1 ( + title %SERVER_HUMP% Quick Start ) -echo Model: -echo - ModelServer (Port: 28680) -echo - ModelWebsite (Port: 18680) +:: ============================================= +:: Validation +:: ============================================= +if not defined !SERVER_UPPER!_MAIN ( + echo [ERROR] !SERVER_UPPER!_MAIN environment variable is not defined + pause && exit /b 1 +) -pause \ No newline at end of file +if not defined !SERVER_UPPER!_MANAGE_BIN ( + echo [ERROR] !SERVER_UPPER!_MANAGE_BIN environment variable is not defined + pause && exit /b 1 +) + +if not defined !SERVER_UPPER!_VM_PARAMS ( + echo Warning: !SERVER_UPPER!_VM_PARAMS environment variable is not defined + set %SERVER_UPPER%_VM_PARAMS=-Xms512m -Xmx2048m +) + +cd /d "!%SERVER_UPPER%_MAIN!" 2>nul +if errorlevel 1 ( + echo [ERROR] Directory not found: !%SERVER_UPPER%_MAIN! + echo Please verify %SERVER_UPPER%_MAIN environment variable + pause && exit /b 1 +) + +if not exist "!%SERVER_UPPER%_MANAGE_BIN!" ( + echo [ERROR] Main JAR file not found: !%SERVER_UPPER%_MANAGE_BIN! + echo Please verify %SERVER_UPPER%_MANAGE_BIN environment variable + pause && exit /b 1 +) + +cd web 2>nul +if errorlevel 1 ( + echo [ERROR] web directory does not exist in !%SERVER_UPPER%_MAIN! + pause && exit /b 1 +) + +if not exist "%SERVER_LOWER%-web.exe" ( + echo [ERROR] %SERVER_LOWER%-web.exe does not exist in !%SERVER_UPPER%_MAIN!\web + pause && exit /b 1 +) + +if not exist "conf\web.conf" ( + echo [ERROR] conf\web.conf does not exist in !%SERVER_UPPER%_MAIN!\web + pause && exit /b 1 +) + +:: ============================================= +:: Service Launch +:: ============================================= +cd .. + +setlocal + +echo Starting %SERVER_HUMP% Server... +jps -v | grep "\-Dserver.port=%SERVER_PORT%" | awk "{print $1}" >server.tmp +set /p pid=nul +if defined pid ( + taskkill -f -pid !pid! +) +start "%SERVER_HUMP% Server" /B cmd /c "chcp 65001 && java !%SERVER_UPPER%_VM_PARAMS! -jar !%SERVER_UPPER%_MANAGE_BIN!" + +echo Starting %SERVER_HUMP% Website... +cd web +taskkill -f -im %SERVER_LOWER%-web.exe >nul +start "%SERVER_HUMP% Website" /B cmd /c "%SERVER_LOWER%-web.exe -c conf\web.conf" + +set MAX_WAIT=300 +set CHECK_INTERVAL=5 +set counter=0 +echo Waiting for services to start... +echo. + +:CHECK_LOOP +netstat -an | find ":%SERVER_PORT%" > nul +set server_up=%errorlevel% + +netstat -an | find ":%WEBSITE_PORT%" > nul +set website_up=%errorlevel% + +if !server_up! equ 0 if !website_up! equ 0 ( + call :DISPLAY_SUCCESS + exit /b 0 +) + +set /a counter+=CHECK_INTERVAL +if !counter! geq %MAX_WAIT% ( + echo Error: Services did not start within !counter! seconds + exit /b 1 +) + +timeout /t %CHECK_INTERVAL% /nobreak > nul +goto CHECK_LOOP + +:DISPLAY_SUCCESS +:: ============================================= +:: Status Display +:: ============================================= +echo. +echo ======================================== +echo %SERVER_HUMP% Services Successfully Started +echo ======================================== +echo - %SERVER_HUMP% Server (Port: %SERVER_PORT%) +echo - %SERVER_HUMP% Website (Port: %WEBSITE_PORT%) +echo ======================================== +echo. +endlocal +exit /b 0 \ No newline at end of file diff --git a/server/model/install-win7-model.iss b/server/model/install-win7-model.iss index 4789d97..35e32c3 100644 --- a/server/model/install-win7-model.iss +++ b/server/model/install-win7-model.iss @@ -1,7 +1,7 @@ ;iss #define MyAppName "模型管理" -#define MyAppVersion "1.0.1" +#define MyAppVersion "1.0.2" #define MyAppPublisher "X" #define MyAppURL "~" #define MyAppExeName "model" diff --git a/server/scenario/Resources/scenario.bat b/server/scenario/Resources/scenario.bat index 3204301..13fb61c 100644 --- a/server/scenario/Resources/scenario.bat +++ b/server/scenario/Resources/scenario.bat @@ -1,18 +1,134 @@ @echo off -chcp 65001 -title Scenario Quick Start +setlocal enabledelayedexpansion +chcp 65001 >nul -cd %SCENARIO_MAIN% -if exist "%SCENARIO_MANAGE_BIN%" ( - start "Scenario Server" cmd /k "java -jar %SCENARIO_VM_PARAMS% -jar %SCENARIO_MANAGE_BIN%" +set SERVER_UPPER=SCENARIO +set SERVER_LOWER=scenario +set SERVER_HUMP=Scenario +set /a SERVER_PORT=28880 +set /a WEBSITE_PORT=%SERVER_PORT%-10000 + +set modifyTitle=1 +for %%a in (%*) do ( + if /i "%%a"=="/notitle" set modifyTitle=0 ) -if exist "%SCENARIO_MANAGE_BIN%" ( - start "Scenario Website" cmd /k "cd web && scenario-web.exe -c conf/web.conf" +if %modifyTitle% equ 1 ( + title %SERVER_HUMP% Quick Start ) -echo Scenario: -echo - ScenarioServer (Port: 28880) -echo - ScenarioWebsite (Port: 18880) +:: ============================================= +:: Validation +:: ============================================= +if not defined !SERVER_UPPER!_MAIN ( + echo [ERROR] !SERVER_UPPER!_MAIN environment variable is not defined + pause && exit /b 1 +) -pause \ No newline at end of file +if not defined !SERVER_UPPER!_MANAGE_BIN ( + echo [ERROR] !SERVER_UPPER!_MANAGE_BIN environment variable is not defined + pause && exit /b 1 +) + +if not defined !SERVER_UPPER!_VM_PARAMS ( + echo Warning: !SERVER_UPPER!_VM_PARAMS environment variable is not defined + set %SERVER_UPPER%_VM_PARAMS=-Xms512m -Xmx2048m +) + +cd /d "!%SERVER_UPPER%_MAIN!" 2>nul +if errorlevel 1 ( + echo [ERROR] Directory not found: !%SERVER_UPPER%_MAIN! + echo Please verify %SERVER_UPPER%_MAIN environment variable + pause && exit /b 1 +) + +if not exist "!%SERVER_UPPER%_MANAGE_BIN!" ( + echo [ERROR] Main JAR file not found: !%SERVER_UPPER%_MANAGE_BIN! + echo Please verify %SERVER_UPPER%_MANAGE_BIN environment variable + pause && exit /b 1 +) + +cd web 2>nul +if errorlevel 1 ( + echo [ERROR] web directory does not exist in !%SERVER_UPPER%_MAIN! + pause && exit /b 1 +) + +if not exist "%SERVER_LOWER%-web.exe" ( + echo [ERROR] %SERVER_LOWER%-web.exe does not exist in !%SERVER_UPPER%_MAIN!\web + pause && exit /b 1 +) + +if not exist "conf\web.conf" ( + echo [ERROR] conf\web.conf does not exist in !%SERVER_UPPER%_MAIN!\web + pause && exit /b 1 +) + +:: ============================================= +:: Service Launch +:: ============================================= +cd .. + +setlocal + +echo Starting %SERVER_HUMP% Server... +jps -v | grep "\-Dserver.port=%SERVER_PORT%" | awk "{print $1}" >server.tmp +set /p pid=nul +if defined pid ( + taskkill -f -pid !pid! +) +start "%SERVER_HUMP% Server" /B cmd /c "chcp 65001 && java !%SERVER_UPPER%_VM_PARAMS! -jar !%SERVER_UPPER%_MANAGE_BIN!" + +echo Starting %SERVER_HUMP% Website... +cd web +cd dist && mkdir temp && cd temp && cp ../wsUrl.js . +sed -i "s/6680/18680/" wsUrl.js >nul +sed -i "s/6681/18280/" wsUrl.js >nul +sed -i "s/6682/18880/" wsUrl.js >nul +sed -i "s/6683/18480/" wsUrl.js >nul +cp wsUrl.js .. && cd .. && rm -rf temp && cd .. +taskkill -f -im %SERVER_LOWER%-web.exe >nul +start "%SERVER_HUMP% Website" /B cmd /c "%SERVER_LOWER%-web.exe -c conf\web.conf" + +set MAX_WAIT=300 +set CHECK_INTERVAL=5 +set counter=0 +echo Waiting for services to start... +echo. + +:CHECK_LOOP +netstat -an | find ":%SERVER_PORT%" > nul +set server_up=%errorlevel% + +netstat -an | find ":%WEBSITE_PORT%" > nul +set website_up=%errorlevel% + +if !server_up! equ 0 if !website_up! equ 0 ( + call :DISPLAY_SUCCESS + exit /b 0 +) + +set /a counter+=CHECK_INTERVAL +if !counter! geq %MAX_WAIT% ( + echo Error: Services did not start within !counter! seconds + exit /b 1 +) + +timeout /t %CHECK_INTERVAL% /nobreak > nul +goto CHECK_LOOP + +:DISPLAY_SUCCESS +:: ============================================= +:: Status Display +:: ============================================= +echo. +echo ======================================== +echo %SERVER_HUMP% Services Successfully Started +echo ======================================== +echo - %SERVER_HUMP% Server (Port: %SERVER_PORT%) +echo - %SERVER_HUMP% Website (Port: %WEBSITE_PORT%) +echo ======================================== +echo. +endlocal +exit /b 0 \ No newline at end of file diff --git a/server/scenario/install-win7-scenario.iss b/server/scenario/install-win7-scenario.iss index 2d267b7..6af90d2 100644 --- a/server/scenario/install-win7-scenario.iss +++ b/server/scenario/install-win7-scenario.iss @@ -1,7 +1,7 @@ ;iss #define MyAppName "想定筹划" -#define MyAppVersion "1.0.1" +#define MyAppVersion "1.0.3" #define MyAppPublisher "X" #define MyAppURL "~" #define MyAppExeName "scenario" diff --git a/server/simulation/Resources/simulation.bat b/server/simulation/Resources/simulation.bat index 9d19df4..79d33ee 100644 --- a/server/simulation/Resources/simulation.bat +++ b/server/simulation/Resources/simulation.bat @@ -1,19 +1,128 @@ @echo off +setlocal enabledelayedexpansion chcp 65001 >nul -title Simulation Quick Start -cd %SIMULATION_MAIN% -if exist "%SIMULATION_MANAGE_BIN%" ( - start "Simulation Server" cmd /k "chcp 65001 && title Simulation Server && java -Dspring.profiles.active=test,mysql,redis,rocketmq,springdoc %SIMULATION_VM_PARAMS% -jar %SIMULATION_MANAGE_BIN%" +set SERVER_UPPER=SIMULATION +set SERVER_LOWER=simulation +set SERVER_HUMP=Simulation +set /a SERVER_PORT=28280 +set /a WEBSITE_PORT=%SERVER_PORT%-10000 + +set modifyTitle=1 +for %%a in (%*) do ( + if /i "%%a"=="/notitle" set modifyTitle=0 ) -if exist "%SIMULATION_MANAGE_BIN%" ( - cd web - start "Simulation Website" cmd /k "title Simulation Website && simulation-web.exe -c conf/web.conf" +if %modifyTitle% equ 1 ( + title %SERVER_HUMP% Quick Start ) -echo Simulation: -echo - SimulationServer (Port: 28280) -echo - SimulationWebsite (Port: 18280) +:: ============================================= +:: Validation +:: ============================================= +if not defined !SERVER_UPPER!_MAIN ( + echo [ERROR] !SERVER_UPPER!_MAIN environment variable is not defined + pause && exit /b 1 +) -pause \ No newline at end of file +if not defined !SERVER_UPPER!_MANAGE_BIN ( + echo [ERROR] !SERVER_UPPER!_MANAGE_BIN environment variable is not defined + pause && exit /b 1 +) + +if not defined !SERVER_UPPER!_VM_PARAMS ( + echo Warning: !SERVER_UPPER!_VM_PARAMS environment variable is not defined + set %SERVER_UPPER%_VM_PARAMS=-Xms512m -Xmx2048m +) + +cd /d "!%SERVER_UPPER%_MAIN!" 2>nul +if errorlevel 1 ( + echo [ERROR] Directory not found: !%SERVER_UPPER%_MAIN! + echo Please verify %SERVER_UPPER%_MAIN environment variable + pause && exit /b 1 +) + +if not exist "!%SERVER_UPPER%_MANAGE_BIN!" ( + echo [ERROR] Main JAR file not found: !%SERVER_UPPER%_MANAGE_BIN! + echo Please verify %SERVER_UPPER%_MANAGE_BIN environment variable + pause && exit /b 1 +) + +cd web 2>nul +if errorlevel 1 ( + echo [ERROR] web directory does not exist in !%SERVER_UPPER%_MAIN! + pause && exit /b 1 +) + +if not exist "%SERVER_LOWER%-web.exe" ( + echo [ERROR] %SERVER_LOWER%-web.exe does not exist in !%SERVER_UPPER%_MAIN!\web + pause && exit /b 1 +) + +if not exist "conf\web.conf" ( + echo [ERROR] conf\web.conf does not exist in !%SERVER_UPPER%_MAIN!\web + pause && exit /b 1 +) + +:: ============================================= +:: Service Launch +:: ============================================= +cd .. + +setlocal + +echo Starting %SERVER_HUMP% Server... +jps -v | grep "\-Dserver.port=%SERVER_PORT%" | awk "{print $1}" >server.tmp +set /p pid=nul +if defined pid ( + taskkill -f -pid !pid! +) +start "%SERVER_HUMP% Server" /B cmd /c "chcp 65001 && java -Dspring.profiles.active=test,mysql,redis,rocketmq,springdoc !%SERVER_UPPER%_VM_PARAMS! -jar !%SERVER_UPPER%_MANAGE_BIN!" + +echo Starting %SERVER_HUMP% Website... +cd web +taskkill -f -im %SERVER_LOWER%-web.exe >nul +start "%SERVER_HUMP% Website" /B cmd /c "%SERVER_LOWER%-web.exe -c conf\web.conf" + +set MAX_WAIT=300 +set CHECK_INTERVAL=5 +set counter=0 +echo Waiting for services to start... +echo. + +:CHECK_LOOP +netstat -an | find ":%SERVER_PORT%" > nul +set server_up=%errorlevel% + +netstat -an | find ":%WEBSITE_PORT%" > nul +set website_up=%errorlevel% + +if !server_up! equ 0 if !website_up! equ 0 ( + call :DISPLAY_SUCCESS + exit /b 0 +) + +set /a counter+=CHECK_INTERVAL +if !counter! geq %MAX_WAIT% ( + echo Error: Services did not start within !counter! seconds + exit /b 1 +) + +timeout /t %CHECK_INTERVAL% /nobreak > nul +goto CHECK_LOOP + +:DISPLAY_SUCCESS +:: ============================================= +:: Status Display +:: ============================================= +echo. +echo ======================================== +echo %SERVER_HUMP% Services Successfully Started +echo ======================================== +echo - %SERVER_HUMP% Server (Port: %SERVER_PORT%) +echo - %SERVER_HUMP% Website (Port: %WEBSITE_PORT%) +echo ======================================== +echo. +endlocal +exit /b 0 \ No newline at end of file diff --git a/server/simulation/install-win7-simulation.iss b/server/simulation/install-win7-simulation.iss index f104fac..af5043a 100644 --- a/server/simulation/install-win7-simulation.iss +++ b/server/simulation/install-win7-simulation.iss @@ -1,7 +1,7 @@ ;iss #define MyAppName "仿真实验" -#define MyAppVersion "1.0.1" +#define MyAppVersion "1.0.3" #define MyAppPublisher "X" #define MyAppURL "~" #define MyAppExeName "simulation"