forked from NoWint/EGGDataScience
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.bat
More file actions
67 lines (56 loc) · 1.63 KB
/
Copy pathstart.bat
File metadata and controls
67 lines (56 loc) · 1.63 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
59
60
61
62
63
64
65
66
67
@echo off
chcp 65001 > nul
REM EEGDataScience 启动脚本 (Windows)
REM 作者: NoWint (https://github.com/NoWint)
cd /d "%~dp0"
echo ================================================
echo EEGDataScience 启动中...
echo 作者: NoWint (https://github.com/NoWint)
echo ================================================
echo.
REM 检查 venv
if not exist "venv" (
echo [错误] 未找到虚拟环境
echo 首次使用请先双击 setup.bat 进行配置
pause
exit /b 1
)
call venv\Scripts\activate
REM 检查端口是否被占用
set PORT=18765
netstat -an | findstr ":%PORT% " | findstr "LISTENING" >nul
if not errorlevel 1 (
echo [提示] 端口 %PORT% 已被占用,可能服务已在运行
echo 正在尝试打开浏览器...
start http://localhost:%PORT%
exit /b 0
)
REM 后台启动服务
echo [1/2] 启动分析服务 (端口 %PORT%)...
start /b pythonw -m app.server > "%TEMP%\eegdatascience.log" 2>&1
REM 等待服务就绪
echo [2/2] 等待服务就绪...
set COUNT=0
:waitloop
timeout /t 1 /nobreak > nul
set /a COUNT+=1
curl -s http://localhost:%PORT%/api/health >nul 2>&1
if not errorlevel 1 goto ready
if %COUNT% lss 15 goto waitloop
echo.
echo [错误] 服务启动失败,请查看日志:
echo type "%TEMP%\eegdatascience.log"
pause
exit /b 1
:ready
echo.
echo ================================================
echo 服务已启动!
echo 地址: http://localhost:%PORT%
echo 日志: %TEMP%\eegdatascience.log
echo ================================================
echo.
echo 浏览器即将打开... (此窗口可关闭)
start http://localhost:%PORT%
timeout /t 2 /nobreak > nul
exit /b 0