Skip to content

Instantly share code, notes, and snippets.

@thnk2wn
Created May 28, 2019 06:37
Show Gist options
  • Save thnk2wn/5366a34a71c8fcfd5e3d14722dc02975 to your computer and use it in GitHub Desktop.
Save thnk2wn/5366a34a71c8fcfd5e3d14722dc02975 to your computer and use it in GitHub Desktop.
$eurekaUrl = "http://localhost:8761/eureka/apps/"
"Checking Eureka status..."
$attempts = 0
$maxAttempts = 20
do {
Start-Sleep ($attempts + 2)
$status = -1
"Testing $eurekaUrl"
try {
$status = Invoke-WebRequest $eurekaUrl | ForEach-Object {$_.StatusCode}
}
catch {
Write-Warning "$($_.Exception.Message)"
}
if ($status -eq 200) {
"Eureka started at $eurekaUrl"
break;
}
$attempts = $attempts + 1
"Eureka not fully started. Attempts $attempts of $maxAttempts. Waiting..."
} while ($attempts -lt $maxAttempts)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment