Files
mtusi2026lab7/scripts/stop-worker.ps1
T
sendormeco d15f2a3631
Application stack (lab7) / stack (pull_request) Canceled after 0s
Skeleton contracts / contracts (pull_request) Canceled after 0s
7 — Т2302 — ебедев — на 5
2026-11-22 23:26:17 +03:00

16 lines
713 B
PowerShell

# Defense scenario: stop ALL workers and leave them stopped (API, broker, storages untouched).
$ErrorActionPreference = 'Continue'
$root = Split-Path -Parent $PSScriptRoot
Set-Location $root
$envFile = if ($env:ENV_FILE) { $env:ENV_FILE } else { '.env' }
function Wait-Healthy([string]$svc) {
foreach ($cid in (& docker compose --env-file $envFile ps -q $svc)) {
for ($i = 0; $i -lt 120; $i++) {
if ((& docker inspect -f '{{.State.Health.Status}}' $cid) -eq 'healthy') { break }
Start-Sleep -Milliseconds 500
}
}
}
& docker compose --env-file $envFile stop worker 2>$null | Out-Null
& docker compose --env-file $envFile ps -a worker --format '{{.Name}} {{.State}}'