From 1ef9a340cd551301edb245d29057dbc32c4aa76a Mon Sep 17 00:00:00 2001 From: Stephan Barth Date: Sun, 20 Oct 2024 02:06:16 +0200 Subject: [PATCH] build(utils/watchcontainerrun.sh): Waiting at most 20 seconds for containerfile now. --- utils/watchcontainerrun.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/utils/watchcontainerrun.sh b/utils/watchcontainerrun.sh index 41bc0ffdd..67e8ab3a5 100755 --- a/utils/watchcontainerrun.sh +++ b/utils/watchcontainerrun.sh @@ -7,8 +7,15 @@ FILENAME="$2" STARTSCRIPT="$3" CLEANUPSCRIPT="$4" -while ! grep -q 'CONTAINER_ID=' "$FILENAME" ; do +TRIES=1 + +while ! grep -q 'CONTAINER_ID=' "$FILENAME" > /dev/null 2&>/dev/null ; do sleep 1 + TRIES=$((1+$TRIES)) + if [ "$TRIES" -ge 20 ] ; then + echo "$0: Containerfile $FILENAME did not show up after 20 seconds, giving up now!" >&2 + exit + fi done sleep 1 # safety, we do not want to have half written container ids