Files
medical-mall/server/scripts/stop-delivery-backend.ps1
not-like-juvenile e67016a6f4 消息推送
2026-03-10 16:39:50 +08:00

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 '"