Created
May 28, 2019 06:37
-
-
Save thnk2wn/5366a34a71c8fcfd5e3d14722dc02975 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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