From 2a597c5c7a8b5468961d8ee176fffe6b427b8a64 Mon Sep 17 00:00:00 2001 From: Konstantin Pavlov Date: Mon, 13 Feb 2023 17:04:24 -0800 Subject: Docker: limited the waiting time for control socket creation. While at it, fixed a typo. --- pkg/docker/docker-entrypoint.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkg/docker/docker-entrypoint.sh b/pkg/docker/docker-entrypoint.sh index 3d134ea2..e0afd7ea 100755 --- a/pkg/docker/docker-entrypoint.sh +++ b/pkg/docker/docker-entrypoint.sh @@ -29,7 +29,14 @@ if [ "$1" = "unitd" ] || [ "$1" = "unitd-debug" ]; then echo "$0: /docker-entrypoint.d/ is not empty, launching Unit daemon to perform initial configuration..." /usr/sbin/$1 --control unix:/var/run/control.unit.sock - while [ ! -S /var/run/control.unit.sock ]; do echo "$0: Waiting for control socket to be created..."; /bin/sleep 0.1; done + for i in $(/usr/bin/seq $WAITLOOPS); do + if [ ! -S /var/run/control.unit.sock ]; then + echo "$0: Waiting for control socket to be created..." + /bin/sleep $SLEEPSEC + else + break + fi + done # even when the control socket exists, it does not mean unit has finished initialisation # this curl call will get a reply once unit is fully launched /usr/bin/curl -s -X GET --unix-socket /var/run/control.unit.sock http://localhost/ @@ -62,7 +69,7 @@ if [ "$1" = "unitd" ] || [ "$1" = "unitd-debug" ]; then for i in $(/usr/bin/seq $WAITLOOPS); do if [ -S /var/run/control.unit.sock ]; then - echo "$0 Waiting for control socket to be removed..." + echo "$0: Waiting for control socket to be removed..." /bin/sleep $SLEEPSEC else break -- cgit