From 8179f7354211e1d5da098e4d5e3be87349384c4f Mon Sep 17 00:00:00 2001 From: Eros Nardi Date: Tue, 2 Mar 2021 10:52:23 +0100 Subject: [PATCH] Added wait to mysql to come up (and infinite loop if there is a problem so it won't make damage) --- entrypoint.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 744ab9c..5fe5fdc 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -13,7 +13,11 @@ sed -i -e 's,/var/lib/mysql,/config/mysql,g' /etc/mysql/mariadb.conf.d/50-server echo "Check MariaDB config" /etc/init.d/mysql start -sleep 5 +while ! mysqladmin ping --silent; do + echo "Waiting mysql startup..." + sleep 3 +done + RESULT=$(mysqlshow --user=zmuser --password=zmpass zm| grep -v Wildcard | grep -o Tables) if [ "$RESULT" != "Tables" ]; then @@ -39,6 +43,10 @@ y EOF /etc/init.d/mysql restart +while ! mysqladmin ping --silent; do + echo "Waiting mysql restart" + sleep 3 +done echo "Configuration done" else echo "MariaDB already configured" @@ -50,6 +58,10 @@ if [ "$RESULT" = "" ]; then echo "Set Mysql timezone" printf "[mysqld]\n default-time-zone=$(cat /etc/timezone)" >> /etc/mysql/my.cnf /etc/init.d/mysql restart + while ! mysqladmin ping --silent; do + echo "Waiting mysql restart..." + sleep 3 + done fi RESULT=$(cat /etc/php/*/apache2/php.ini| grep "date.timezone =")