Created
July 9, 2021 09:57
-
-
Save ziadoz/419303d6dc040941b97e7f82ca14ff05 to your computer and use it in GitHub Desktop.
Wait for MySQL to Start
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
#!/usr/bin/env bash | |
# Load dot environment file: | |
export $(cat .env | xargs) | |
# Wait for MySQL service to start (this could be on the host or in a Docker container): | |
until mysql -h "$MYSQL_HOST" -P "$MYSQL_PORT" -u "$MYSQL_USER" -p"$MYSQL_PASSWORD" -e '\q'; do | |
>&2 echo "MySQL container is unavailable - sleeping" | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment