diff options
author | asteroide <thomas.duval@orange.com> | 2017-07-27 09:32:00 +0200 |
---|---|---|
committer | asteroide <thomas.duval@orange.com> | 2017-07-27 09:32:00 +0200 |
commit | 8441963637c265b88fde6903c7dc9c26916dc872 (patch) | |
tree | 440ae99f99bdca090f4a2ad54a5dfbb2ca43a5ba /moonv4 | |
parent | e0e0e64309b599b6f754195f102aac2d1fcd8341 (diff) |
Add commands to wait for the database to set up
Change-Id: Ifa6453f4399b203611745820f4ea4ad8afcf49c8
Diffstat (limited to 'moonv4')
-rw-r--r-- | moonv4/templates/moon_keystone/run.sh | 7 |
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'; |