[why] check service ready or not every 2s, if ok, continue next step, rather than sleep 60s, it can save time.
Signed-off-by: Liu Yinsi liuyinsi@163.com --- container/defconfig.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/container/defconfig.sh b/container/defconfig.sh index c33a790..50446d8 100755 --- a/container/defconfig.sh +++ b/container/defconfig.sh @@ -28,9 +28,15 @@ docker_rm() docker rm -f $container }
-set_es_indices() +check_service_ready() { - find $CCI_SRC/sbin/ -name "es-*-mapping.sh" -exec sh {} ; + local port=$1 + local i + for i in {1..30} + do + curl -s localhost:$port > /dev/null && return + sleep 2 + done }
push_image()