Created
March 20, 2018 18:57
-
-
Save lvthillo/7af222367a41e30c33c95455b7aa6191 to your computer and use it in GitHub Desktop.
wait-for-it.sh to Check if MySQL service is running using environment variables
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
#!/bin/bash | |
set -e | |
host="$1" | |
shift | |
cmd="$@" | |
until mysql -hmysql -p"3306" -u"${database__connection__user}" -p"${database__connection__password}" | |
-D"${database__connection__database}" ; do | |
>&2 echo "MySQL is unavailable - sleeping" | |
sleep 1 | |
done | |
>&2 echo "MySQL is up - executing command" | |
exec "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment