File size: 796 Bytes
f871fed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Stop all Open Notebook services
Write-Host "Stopping Open Notebook services..." -ForegroundColor Yellow

# Kill any running Python/Node processes on our ports
$processes = Get-NetTCPConnection -LocalPort 5055,8502 -ErrorAction SilentlyContinue | Select-Object -ExpandProperty OwningProcess -Unique

if ($processes) {
    foreach ($procId in $processes) {
        try {
            Write-Host "Killing process $procId..." -ForegroundColor Yellow
            Stop-Process -Id $procId -Force -ErrorAction SilentlyContinue
        } catch {
            Write-Host "Could not stop process $procId" -ForegroundColor Red
        }
    }
    Write-Host "Waiting for ports to be released..." -ForegroundColor Yellow
    Start-Sleep -Seconds 2
}

Write-Host "All services stopped" -ForegroundColor Green