Skip to content

Instantly share code, notes, and snippets.

@osorionicolas
Created February 4, 2022 23:42
Show Gist options
  • Select an option

  • Save osorionicolas/60a27202f2e68ead3c792964ec1a269f to your computer and use it in GitHub Desktop.

Select an option

Save osorionicolas/60a27202f2e68ead3c792964ec1a269f to your computer and use it in GitHub Desktop.
#!/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