summaryrefslogtreecommitdiffhomepage
path: root/pkg
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
commit2a597c5c7a8b5468961d8ee176fffe6b427b8a64 (patch)
treec6a8c6437192477c75e6244edc39efc590515668 /pkg
parent054518bb360e4be6d4892025c02c811872d93e99 (diff)
downloadunit-2a597c5c7a8b5468961d8ee176fffe6b427b8a64.tar.gz
unit-2a597c5c7a8b5468961d8ee176fffe6b427b8a64.tar.bz2
Docker: limited the waiting time for control socket creation.
While at it, fixed a typo.
Diffstat (limited to 'pkg')
-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