Files
pgserver3.0/pgadmin/bin/run_win.bat
annnj-company 130c1026c4 first commit
2026-04-17 18:29:53 +08:00

46 lines
1.3 KiB
Batchfile
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@echo off
echo.
echo [检查] 正在检查数据库连接...
echo.
cd %~dp0
rem 配置
for /f "tokens=1,2 delims==" %%a in (config.ini) do (
if "%%a"=="DB_HOST" set DB_HOST=%%b
if "%%a"=="DB_PORT" set DB_PORT=%%b
if "%%a"=="REDIS_HOST" set REDIS_HOST=%%b
if "%%a"=="REDIS_PORT" set REDIS_PORT=%%b
)
cd ../ruoyi-admin/target
set JAVA_OPTS=-Xms256m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
rem 检查DB
echo [检查] 正在检查数据库连接...
powershell -Command "$conn = New-Object System.Net.Sockets.TcpClient; $result = $conn.ConnectAsync('%DB_HOST%', %DB_PORT%).Wait(1000); if (!$result) { exit 1 } else { exit 0 }"
if %errorlevel% neq 0 (
echo [错误] Redis连接失败请检查Redis IP: %REDIS_HOST%,端口: %REDIS_PORT%
goto end
)
echo [成功] 数据库连接正常
rem 链接Redis
echo [检查] 正在检查Redis连接....
powershell -Command "$conn = New-Object System.Net.Sockets.TcpClient; $result = $conn.ConnectAsync('%REDIS_HOST%', %REDIS_PORT%).Wait(1000); if (!$result) { exit 1 } else { exit 0 }"
if %errorlevel% neq 0 (
echo [错误] Redis连接失败请检查Redis IP: %REDIS_HOST%,端口: %REDIS_PORT%
goto end
)
echo [成功] Redis连接正常
echo [信息] 所有服务检查完成,开始启动应用...
echo.
java -jar %JAVA_OPTS% ruoyi-admin.jar --spring.redis.host=%REDIS_HOST% --spring.redis.port=%REDIS_PORT%
:end
cd bin
pause