From 8441963637c265b88fde6903c7dc9c26916dc872 Mon Sep 17 00:00:00 2001 From: asteroide Date: Thu, 27 Jul 2017 09:32:00 +0200 Subject: Add commands to wait for the database to set up Change-Id: Ifa6453f4399b203611745820f4ea4ad8afcf49c8 --- moonv4/templates/moon_keystone/run.sh | 7 +++++++ 1 file changed, 7 insertions(+) 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 <