
On Wed, Feb 24, 2021 at 08:20:13PM +0800, Liu Yinsi wrote:
before: es/logging-es startup time is 60s after: es/logging-es startup time is 10s
[how] check es ready or not every 2s, if ok, just set index, rather than sleep 60s.
Signed-off-by: Liu Yinsi <liuyinsi@163.com> --- container/defconfig.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/container/defconfig.sh b/container/defconfig.sh index c33a790..ee66ea5 100755 --- a/container/defconfig.sh +++ b/container/defconfig.sh @@ -28,9 +28,18 @@ docker_rm() docker rm -f $container }
-set_es_indices() +check_es_ready()
check_es_ready() => wait_es_ready()
{ - find $CCI_SRC/sbin/ -name "es-*-mapping.sh" -exec sh {} \; + port=$1
local i for i in ...
+ for num in {1..30} + do
+ curl -s localhost:$port > /dev/null + if [ $? == "0" ]; then + break + else + sleep 2 + fi
=> sleep 2 curl ... && return
+ done
What if ES still not up? exit here? Thanks, Fengguang
}
push_image() -- 2.23.0