27 lines
777 B
PowerShell
27 lines
777 B
PowerShell
$ErrorActionPreference = 'SilentlyContinue'
|
|
|
|
$root = Resolve-Path (Join-Path $PSScriptRoot "..\..")
|
|
$pidsFile = Join-Path $root 'server\.runtime\delivery-backend.pids.json'
|
|
|
|
if (Test-Path $pidsFile) {
|
|
try {
|
|
$pids = Get-Content $pidsFile -Raw | ConvertFrom-Json
|
|
foreach ($name in $pids.PSObject.Properties.Name) {
|
|
$pid = [int]$pids.$name
|
|
if ($pid -gt 0) {
|
|
try {
|
|
Stop-Process -Id $pid -Force
|
|
Write-Host "Stopped $name PID=$pid"
|
|
} catch {
|
|
Write-Host "Failed to stop $name PID=$pid"
|
|
}
|
|
}
|
|
}
|
|
} catch {
|
|
Write-Host "Failed to parse $pidsFile"
|
|
}
|
|
} else {
|
|
Write-Host "No pid file found: $pidsFile"
|
|
}
|
|
|
|
Write-Host "If ports still occupied, run: netstat -ano | Select-String ':7201 ' / ':7301 '" |