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

index 0e1abc9..4ba0757 100755 (executable)
@@ -33,8 +33,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_USER -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