aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--moonv4/templates/moon_keystone/run.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/moonv4/templates/moon_keystone/run.sh b/moonv4/templates/moon_keystone/run.sh
index ea9b7984..2a61901e 100644
--- a/moonv4/templates/moon_keystone/run.sh
+++ b/moonv4/templates/moon_keystone/run.sh
@@ -18,6 +18,13 @@ max_age = 3600
allow_methods = POST,GET,DELETE
EOF
+until echo status | mysql -h${DB_HOST} -u${DB_USER_ROOT} -p${DB_PASSWORD_ROOT}; do
+ >&2 echo "MySQL is unavailable - sleeping"
+ sleep 1
+done
+
+>&2 echo "Mysql is up - executing command"
+
mysql -h $DB_HOST -u$DB_USER_ROOT -p$DB_PASSWORD_ROOT <<EOF
CREATE DATABASE $DB_DATABASE DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON $DB_DATABASE.* TO '$DB_USER'@'%' IDENTIFIED BY '$DB_PASSWORD';