From 4e217efb54c9adeaf099a222651ca1772822888f Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Fri, 4 Dec 2020 09:59:45 +1100 Subject: [PATCH] feat: ensure supercronic only loads the crontab once when the entrypoint is called multiple times during startup --- pact_broker/entrypoint.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pact_broker/entrypoint.sh b/pact_broker/entrypoint.sh index e622a7d..7c71821 100755 --- a/pact_broker/entrypoint.sh +++ b/pact_broker/entrypoint.sh @@ -1,8 +1,9 @@ #!/bin/sh -if [ "${PACT_BROKER_DATABASE_BETA_CLEAN_ENABLED}" = "true" ]; then +if [ "${PACT_BROKER_DATABASE_BETA_CLEAN_ENABLED}" = "true" ] && [ ! -f .supercronic ]; then echo "Creating crontab with schedule ${PACT_BROKER_DATABASE_CLEAN_CRON_SCHEDULE} to clean database" echo "${PACT_BROKER_DATABASE_CLEAN_CRON_SCHEDULE} /pact_broker/clean.sh" >> /pact_broker/crontab + touch .supercronic /usr/local/bin/supercronic -quiet -passthrough-logs /pact_broker/crontab & fi