$ErrorActionPreference = "Stop" $root = Split-Path -Parent $PSScriptRoot $pidFile = Join-Path $root "runtime\\order-service.pid" if (-not (Test-Path $pidFile)) { Write-Output "not running" exit 0 } $appPid = Get-Content -LiteralPath $pidFile | Select-Object -First 1 if ($appPid) { Stop-Process -Id ([int]$appPid) -Force -ErrorAction SilentlyContinue } Remove-Item -LiteralPath $pidFile -Force -ErrorAction SilentlyContinue Write-Output "stopped"