Modify DB initialization completion judgment flag 17/102817/1
authoryangyan <yangyanyj@chinamobile.com>
Tue, 3 Mar 2020 07:08:10 +0000 (15:08 +0800)
committeryangyan <yangyanyj@chinamobile.com>
Tue, 3 Mar 2020 07:08:15 +0000 (15:08 +0800)
Change-Id: I8a9ad0b37c41a9f56f3b4b8f26491883b7e8caaa
Issue-ID: VFC-1639
Signed-off-by: yangyan <yangyanyj@chinamobile.com>
docker/docker-entrypoint.sh

index c0f2d8f..24dce8a 100755 (executable)
@@ -34,8 +34,8 @@ done
 # Wait for DB initialization
 echo "Wait for DB initialization"
 for i in {1..5}; do
-    curl -sS -m 1 $MYSQL_ADDR > /dev/null && break
-    sleep $i
+    mysql -u$MYSQL_ROOT_USER1 -p$MYSQL_ROOT_PASSWORD -h`echo $MYSQL_ADDR | cut -d: -f 1` -P`echo $MYSQL_ADDR | cut -d: -f 2` -e "show databases;" > /dev/null && echo "DB initialization completed" && break
+    sleep $i && echo "`echo $MYSQL_ADDR | cut -d: -f 1` connection failed"
 done
 
 # Configure service based on docker environment variables