# Stop Geutebruck API Services # This script stops Flutter Web, Python API, SDK Bridge, and GeViServer # # Usage: # .\stop-services.ps1 # Stop all services # .\stop-services.ps1 -KeepGeViServer # Stop only API/Bridge, keep GeViServer running param( [switch]$KeepGeViServer ) $ErrorActionPreference = "SilentlyContinue" Write-Host "========================================" -ForegroundColor Cyan if ($KeepGeViServer) { Write-Host "Stopping API Services (keeping GeViServer)" -ForegroundColor Cyan } else { Write-Host "Stopping Geutebruck API Services" -ForegroundColor Cyan } Write-Host "========================================" -ForegroundColor Cyan Write-Host "" # Stop Flutter Web Server $flutterPort = Get-NetTCPConnection -LocalPort 8081 -State Listen -ErrorAction SilentlyContinue if ($flutterPort) { $flutterPid = $flutterPort | Select-Object -First 1 -ExpandProperty OwningProcess Write-Host "[1/5] Stopping Flutter Web (PID: $flutterPid)..." -ForegroundColor Yellow Stop-Process -Id $flutterPid -Force Write-Host " [OK] Flutter Web stopped" -ForegroundColor Green } else { Write-Host "[1/5] Flutter Web is not running" -ForegroundColor Gray } # Stop Python API $uvicorn = Get-Process -Name "uvicorn" if ($uvicorn) { Write-Host "[2/5] Stopping Python API (PID: $($uvicorn.Id))..." -ForegroundColor Yellow Stop-Process -Name "uvicorn" -Force Write-Host " [OK] Python API stopped" -ForegroundColor Green } else { Write-Host "[2/5] Python API is not running" -ForegroundColor Gray } # Stop SDK Bridge $sdkBridge = Get-Process -Name "GeViScopeBridge" if ($sdkBridge) { Write-Host "[3/5] Stopping SDK Bridge (PID: $($sdkBridge.Id))..." -ForegroundColor Yellow Stop-Process -Name "GeViScopeBridge" -Force Write-Host " [OK] SDK Bridge stopped" -ForegroundColor Green } else { Write-Host "[3/5] SDK Bridge is not running" -ForegroundColor Gray } # Stop C# GeViServer Bridge $geviServerBridge = Get-Process -Name "GeViServerBridge" if ($geviServerBridge) { Write-Host "[4/5] Stopping C# GeViServer Bridge (PID: $($geviServerBridge.Id))..." -ForegroundColor Yellow Stop-Process -Name "GeViServerBridge" -Force Write-Host " [OK] C# Bridge stopped" -ForegroundColor Green } else { Write-Host "[4/5] C# GeViServer Bridge is not running" -ForegroundColor Gray } # Stop GeViServer (unless -KeepGeViServer flag is set) if (-not $KeepGeViServer) { $geviServer = Get-Process -Name "GeViServer" if ($geviServer) { Write-Host "[5/5] Stopping GeViServer (PID: $($geviServer.Id))..." -ForegroundColor Yellow Stop-Process -Name "GeViServer" -Force Write-Host " [OK] GeViServer stopped" -ForegroundColor Green } else { Write-Host "[5/5] GeViServer is not running" -ForegroundColor Gray } } else { $geviServer = Get-Process -Name "GeViServer" if ($geviServer) { Write-Host "[5/5] Keeping GeViServer running (PID: $($geviServer.Id))" -ForegroundColor Green } else { Write-Host "[5/5] GeViServer is not running (cannot keep)" -ForegroundColor Yellow } } Write-Host "" Write-Host "========================================" -ForegroundColor Green Write-Host "Services Stopped" -ForegroundColor Green Write-Host "========================================" -ForegroundColor Green