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