summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorKonstantin Pavlov <thresh@nginx.com>2023-02-13 17:04:24 -0800
committerKonstantin Pavlov <thresh@nginx.com>2023-02-13 17:04:24 -0800
commitbd64caadfef9dc6e0f2ebccefe927779620ac40e (patch)
tree0a184fc3f0961d8f24a65e286e292b2d9fae34ac
parentc056ad195bf91a199e2754fa48c3806f9bfe2ca0 (diff)
downloadunit-bd64caadfef9dc6e0f2ebccefe927779620ac40e.tar.gz
unit-bd64caadfef9dc6e0f2ebccefe927779620ac40e.tar.bz2
Docker: limited the waiting time for control socket creation.
While at it, fixed a typo.
-rwxr-xr-xpkg/docker/docker-entrypoint.sh11
1 files 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