Created
March 4, 2022 19:08
-
-
Save elbasan/1ebe1059daf07c3b19fe55c4d848fe19 to your computer and use it in GitHub Desktop.
wait-for-redis
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
#!/usr/bin/env bash | |
hostport=(${1//:/ }) | |
HOST=${hostport[0]} | |
PORT=${hostport[1]} | |
echo "Start waiting for Redis fully start. Host '$HOST', '$PORT'..." | |
echo "Try ping Redis... " | |
PONG=`redis-cli -h $HOST -p $PORT ping | grep PONG` | |
while [ -z "$PONG" ]; do | |
sleep 1 | |
echo "Retry Redis ping... " | |
PONG=`redis-cli -h $HOST -p $PORT ping | grep PONG` | |
done | |
echo "Redis at host '$HOST', port '$PORT' fully started." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment