Innovenergy_trunk/firmware/Cerbo_Release/CerboReleaseFiles/pika-0.13.1/testdata/wait-rabbitmq.ps1

22 lines
623 B
PowerShell
Raw Normal View History

2024-06-05 10:33:44 +00:00
[int]$count = 1
Do {
$proc_id = (Get-Process -Name erl).Id
if (-Not ($proc_id -is [array])) {
& "C:\Program Files\RabbitMQ Server\rabbitmq_server-$env:rabbitmq_version\sbin\rabbitmqctl.bat" wait -t 300000 -P $proc_id
if ($LASTEXITCODE -ne 0) {
throw "[ERROR] rabbitmqctl wait returned error: $LASTEXITCODE"
}
break
}
if ($count -gt 120) {
throw '[ERROR] too many tries waiting for just one erl process to be running'
}
Write-Host '[INFO] multiple erl instances running still'
$count = $count + 1
Start-Sleep -Seconds 5
} While ($true)