Created
February 4, 2022 23:42
-
-
Save osorionicolas/60a27202f2e68ead3c792964ec1a269f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/bin/bash | |
| HOST=$1 | |
| # port defaults to 8080 | |
| PORT=${2:-8080} | |
| RETRIES=50 | |
| echo -n "Waiting for keycloak to start on ${HOST}:${PORT}" | |
| # loop until we connect successfully or failed | |
| until curl -f -v "http://${HOST}:${PORT}/" >/dev/null 2>/dev/null | |
| do | |
| RETRIES=$(($RETRIES - 1)) | |
| if [ $RETRIES -eq 0 ] | |
| then | |
| echo "Failed to connect" | |
| exit 1 | |
| fi | |
| # wait a bit | |
| echo -n "." | |
| sleep 1 | |
| done | |
| echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment