-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-all.bat
More file actions
58 lines (49 loc) · 1.96 KB
/
start-all.bat
File metadata and controls
58 lines (49 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
@echo off
setlocal EnableDelayedExpansion
cd /d "%~dp0"
chcp 65001 >nul
echo ======================================
echo FastAgent 一键启动
echo ======================================
echo.
echo [信息] 正在启动FastAgent后端服务...
start cmd /k "title FastAgent后端服务 & scripts\bat\start.bat"
echo [信息] 等待后端启动...
set /a retry_count=0
set /a max_retries=30
:check_backend
timeout /t 2 /nobreak >nul
set /a retry_count+=1
echo [信息] 检查后端服务状态 (尝试 %retry_count%/%max_retries%)...
powershell -command "try { $response = Invoke-WebRequest -Uri 'http://localhost:8002/health' -UseBasicParsing -TimeoutSec 2; if ($response.StatusCode -eq 200) { exit 0 } else { exit 1 } } catch { exit 1 }"
if %ERRORLEVEL% EQU 0 (
echo [成功] 后端服务已启动!
goto start_frontend
)
if %retry_count% LSS %max_retries% goto check_backend
echo [警告] 后端服务可能未正确启动,但仍将尝试启动前端服务...
:start_frontend
echo [信息] 正在启动FastAgent前端服务...
start cmd /k "title FastAgent前端服务 & scripts\bat\start-frontend.bat"
echo [信息] 等待前端启动...
set /a retry_count=0
:check_frontend
timeout /t 2 /nobreak >nul
set /a retry_count+=1
echo [信息] 检查前端服务状态 (尝试 %retry_count%/%max_retries%)...
powershell -command "try { $response = Invoke-WebRequest -Uri 'http://localhost:3000' -UseBasicParsing -TimeoutSec 2; if ($response.StatusCode -eq 200) { exit 0 } else { exit 1 } } catch { exit 1 }"
if %ERRORLEVEL% EQU 0 (
echo [成功] 前端服务已启动!
goto all_started
)
if %retry_count% LSS %max_retries% goto check_frontend
echo [警告] 前端服务可能未正确启动,请手动检查...
:all_started
echo.
echo [信息] FastAgent 启动状态:
echo 前端地址: http://localhost:3000
echo 后端地址: http://localhost:8002/docs
echo.
echo 注意: 服务已在独立的命令窗口中运行,关闭这些窗口将停止对应服务。
echo.
endlocal