From bfc8f255d7b0484732d32529fe605b1fd36fdec3 Mon Sep 17 00:00:00 2001 From: nesies <> Date: Tue, 4 Jul 2023 15:34:52 +0200 Subject: [PATCH] wait-for-it_several_databases --- camunda-run.sh | 15 ++++++++++++++- camunda-tomcat.sh | 15 ++++++++++++++- camunda-wildfly.sh | 15 ++++++++++++++- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/camunda-run.sh b/camunda-run.sh index 85d8e3b6..be1dedce 100755 --- a/camunda-run.sh +++ b/camunda-run.sh @@ -31,7 +31,20 @@ fi CMD="/camunda/internal/run.sh start" if [ -n "${WAIT_FOR}" ]; then - CMD="wait-for-it.sh ${WAIT_FOR} -s -t ${WAIT_FOR_TIMEOUT} -- ${CMD}" + found=0 + for tmp in $(echo "${WAIT_FOR}" | tr ',' '\n'); do + if wait-for-it.sh "$tmp" -s -t ${WAIT_FOR_TIMEOUT} ; then + echo "$tmp up" + found=1 + break + else + echo "$tmp down" + fi + done + if [ "$found" -eq 0 ] ; then + echo "nothing up in WAIT_FOR=$WAIT_FOR" + exit 1 + fi fi # shellcheck disable=SC2086 diff --git a/camunda-tomcat.sh b/camunda-tomcat.sh index 51b1d5d2..e0dc2413 100755 --- a/camunda-tomcat.sh +++ b/camunda-tomcat.sh @@ -59,7 +59,20 @@ fi CMD+=" run" if [ -n "${WAIT_FOR}" ]; then - CMD="wait-for-it.sh ${WAIT_FOR} -s -t ${WAIT_FOR_TIMEOUT} -- ${CMD}" + found=0 + for tmp in $(echo "${WAIT_FOR}" | tr ',' '\n'); do + if wait-for-it.sh "$tmp" -s -t ${WAIT_FOR_TIMEOUT} ; then + echo "$tmp up" + found=1 + break + else + echo "$tmp down" + fi + done + if [ "$found" -eq 0 ] ; then + echo "nothing up in WAIT_FOR=$WAIT_FOR" + exit 1 + fi fi # shellcheck disable=SC2086 diff --git a/camunda-wildfly.sh b/camunda-wildfly.sh index ded70e94..c70f36a3 100755 --- a/camunda-wildfly.sh +++ b/camunda-wildfly.sh @@ -81,7 +81,20 @@ if [ "$JMX_PROMETHEUS" = "true" ] ; then fi if [ -n "${WAIT_FOR}" ]; then - CMD="wait-for-it.sh ${WAIT_FOR} -s -t ${WAIT_FOR_TIMEOUT} -- ${CMD}" + found=0 + for tmp in $(echo "${WAIT_FOR}" | tr ',' '\n'); do + if wait-for-it.sh "$tmp" -s -t ${WAIT_FOR_TIMEOUT} ; then + echo "$tmp up" + found=1 + break + else + echo "$tmp down" + fi + done + if [ "$found" -eq 0 ] ; then + echo "nothing up in WAIT_FOR=$WAIT_FOR" + exit 1 + fi fi # shellcheck disable=SC2086