summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ0WI <J0WI@users.noreply.github.com>2022-04-28 18:32:38 +0000
committerGitHub <noreply@github.com>2022-04-28 18:32:38 +0000
commit7a89d751ca0732272529692fad8b61c9c0af5532 (patch)
tree24d5196a7eb9765d3834181b455d30fb7a80b396
parent3f42156a0705785a502acfb71d08781bba3cb277 (diff)
Limit until loop (#1741)
Signed-off-by: J0WI <J0WI@users.noreply.github.com>
-rwxr-xr-xdocker-entrypoint.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh
index 413ae9c6..6c8f35f4 100755
--- a/docker-entrypoint.sh
+++ b/docker-entrypoint.sh
@@ -106,15 +106,20 @@ if expr "$1" : "apache" 1>/dev/null || [ "$1" = "php-fpm" ] || [ "${NEXTCLOUD_UP
# it to be done, then escape initalization
lock=/var/www/html/nextcloud-init-sync.lock
count=0
+ limit=10
if [ -f "$lock" ]; then
- until [ ! -f "$lock" ]
+ until [ ! -f "$lock" ] || [ "$count" -gt "$limit" ]
do
count=$((count+1))
wait=$((count*10))
echo "Another process is initializing Nextcloud. Waiting $wait seconds..."
sleep $wait
done
+ if [ "$count" -gt "$limit" ]; then
+ echo "Timeout while waiting for an ongoing initialization"
+ exit 1
+ fi
echo "The other process is done, assuming complete initialization"
else
# Prevent multiple images syncing simultaneously