From d045b40c2c8436ff237ba2948e5d1b901bfd9923 Mon Sep 17 00:00:00 2001 From: Al Berez Date: Wed, 27 Dec 2023 14:29:27 -0800 Subject: [PATCH] Nginx healthcheck script to tollerate nginx unavailability Addresses https://github.com/cloudfoundry/capi-release/issues/364 If Nginx restarts, the healthcheck curl exits with code 7, triggering another Nginx restart. To avoid this, we need stay in the loop and retry to allow Nginx to complete the restart. --- .../templates/ccng_monit_http_healthcheck.sh.erb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jobs/cloud_controller_ng/templates/ccng_monit_http_healthcheck.sh.erb b/jobs/cloud_controller_ng/templates/ccng_monit_http_healthcheck.sh.erb index 9c5c9376b9..31626edbcc 100644 --- a/jobs/cloud_controller_ng/templates/ccng_monit_http_healthcheck.sh.erb +++ b/jobs/cloud_controller_ng/templates/ccng_monit_http_healthcheck.sh.erb @@ -51,8 +51,10 @@ while true; do status=$? set -e if [[ $status > 0 ]] ; then - echo $(date --rfc-3339=ns) "ccng_monit_http_healthcheck failed to curl <${URL}>: exit code $status" - exit $status + echo "$(date --rfc-3339=ns) ccng_monit_http_healthcheck failed to curl <${URL}>: exit code $status" + if [[ $status != 7 ]] ; then + exit $status + fi fi sleep 10 done