erste Fassung von Client und Server rein
This commit is contained in:
74
bin/server.bat
Normal file
74
bin/server.bat
Normal file
@@ -0,0 +1,74 @@
|
||||
@echo off
|
||||
|
||||
REM ================================================================
|
||||
REM PLANTPLAN - Server (FastAPI/Uvicorn) verwalten
|
||||
REM Verwendung: server.bat [start|stop|reload|status]
|
||||
REM ================================================================
|
||||
|
||||
call "%~dp0setenv.bat"
|
||||
|
||||
if "%1"=="" goto usage
|
||||
|
||||
if /i "%1"=="start" goto start
|
||||
if /i "%1"=="stop" goto stop
|
||||
if /i "%1"=="reload" goto reload
|
||||
if /i "%1"=="status" goto status
|
||||
goto usage
|
||||
|
||||
:start
|
||||
echo Starting PlantPlan Server (uvicorn) ...
|
||||
|
||||
REM Pruefen ob Server bereits laeuft
|
||||
tasklist /FI "WINDOWTITLE eq PlantPlan-Server" 2>nul | find /i "cmd.exe" >nul
|
||||
if not errorlevel 1 (
|
||||
echo Server laeuft bereits!
|
||||
goto end
|
||||
)
|
||||
|
||||
REM Pruefen ob venv existiert
|
||||
if not exist "%PROJECT%\.venv\Scripts\activate.bat" (
|
||||
echo FEHLER: .venv nicht gefunden! Bitte zuerst install_py.bat ausfuehren.
|
||||
goto end
|
||||
)
|
||||
|
||||
start "PlantPlan-Server" cmd /k "cd /d "%PV_SERVER%" && "%PROJECT%\.venv\Scripts\activate.bat" && uvicorn main:app --reload --host %PV_SERVER_HOST% --port %PV_SERVER_PORT%"
|
||||
echo Server gestartet auf %PV_SERVER_URL%
|
||||
goto end
|
||||
|
||||
:stop
|
||||
echo Stopping PlantPlan Server ...
|
||||
taskkill /FI "WINDOWTITLE eq PlantPlan-Server" /T /F >nul 2>&1
|
||||
if errorlevel 1 (
|
||||
echo Server war nicht gestartet.
|
||||
) else (
|
||||
echo Server gestoppt.
|
||||
)
|
||||
goto end
|
||||
|
||||
:reload
|
||||
echo Reloading PlantPlan Server ...
|
||||
call :stop
|
||||
timeout /t 2 /nobreak >nul
|
||||
call :start
|
||||
goto end
|
||||
|
||||
:status
|
||||
tasklist /FI "WINDOWTITLE eq PlantPlan-Server" 2>nul | find /i "cmd.exe" >nul
|
||||
if not errorlevel 1 (
|
||||
echo Server: LAEUFT
|
||||
) else (
|
||||
echo Server: GESTOPPT
|
||||
)
|
||||
goto end
|
||||
|
||||
:usage
|
||||
echo.
|
||||
echo Verwendung: server.bat [start^|stop^|reload^|status]
|
||||
echo.
|
||||
echo start - Server starten (uvicorn mit --reload)
|
||||
echo stop - Server stoppen
|
||||
echo reload - Server neu starten
|
||||
echo status - Pruefen ob Server laeuft
|
||||
echo.
|
||||
|
||||
:end
|
||||
Reference in New Issue
Block a user