80 lines
2.3 KiB
Batchfile
80 lines
2.3 KiB
Batchfile
@echo off
|
|
chcp 65001 >nul
|
|
echo =======================================
|
|
echo Starting LightRAG Production System (Fixed)
|
|
echo =======================================
|
|
|
|
REM Kill any existing process using port 3015 with improved logic
|
|
echo Checking for existing server on port 3015...
|
|
setlocal enabledelayedexpansion
|
|
|
|
REM Use multiple methods to find and kill processes
|
|
echo Method 1: Using netstat...
|
|
for /f "tokens=5" %%a in ('netstat -ano ^| findstr :3015') do (
|
|
set pid=%%a
|
|
echo Found process with PID !pid! using port 3015
|
|
taskkill /F /PID !pid! >nul 2>&1
|
|
if errorlevel 1 (
|
|
echo Failed to kill process !pid!. It may have already exited.
|
|
) else (
|
|
echo Process !pid! killed.
|
|
)
|
|
)
|
|
|
|
REM Wait a moment for port to be released
|
|
timeout /t 2 /nobreak >nul
|
|
|
|
REM Method 2: Try to find Python processes running LightRAG
|
|
echo Method 2: Checking for Python LightRAG processes...
|
|
for /f "tokens=2" %%a in ('tasklist /fi "imagename eq python.exe" /fo csv ^| findstr /i "lightrag"') do (
|
|
set "pid=%%~a"
|
|
echo Found Python LightRAG process with PID !pid!
|
|
taskkill /F /PID !pid! >nul 2>&1
|
|
if errorlevel 1 (
|
|
echo Failed to kill Python process !pid!.
|
|
) else (
|
|
echo Python process !pid! killed.
|
|
)
|
|
)
|
|
|
|
REM Wait again
|
|
timeout /t 2 /nobreak >nul
|
|
|
|
REM Check if port is still in use
|
|
echo Checking if port 3015 is available...
|
|
netstat -ano | findstr :3015 >nul
|
|
if errorlevel 1 (
|
|
echo Port 3015 is available.
|
|
) else (
|
|
echo WARNING: Port 3015 may still be in use.
|
|
echo Trying to start server anyway...
|
|
)
|
|
|
|
REM Recompile web UI if source exists
|
|
echo Checking web UI source...
|
|
if exist "LightRAG-main\lightrag_webui\package.json" (
|
|
echo Found web UI source. Building...
|
|
cd LightRAG-main\lightrag_webui
|
|
REM Check if bun is available
|
|
where bun >nul 2>&1
|
|
if errorlevel 1 (
|
|
echo bun not found, using npm...
|
|
call npm run build-no-bun
|
|
) else (
|
|
echo Using bun...
|
|
call bun run build
|
|
)
|
|
cd ..\..
|
|
echo Web UI build completed.
|
|
) else (
|
|
echo Web UI source not found, using pre-built assets.
|
|
)
|
|
|
|
REM Start the LightRAG server using the improved Python script
|
|
echo Starting LightRAG server with improved configuration...
|
|
python start_server_fixed_improved.py
|
|
|
|
REM If the script exits, pause so we can see any error messages
|
|
echo.
|
|
echo Server has stopped. Press any key to exit...
|
|
pause >nul |