Innovenergy_trunk/NodeRed/NodeRedFiles/pika-0.13.1/testdata/wait-rabbitmq.ps1

22 lines
623 B
PowerShell

[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)