From 3e3e43c13d6dc5c95fccf2cceb1c634dc9543ffb Mon Sep 17 00:00:00 2001 From: Chloend Date: Tue, 24 Dec 2024 11:06:30 +0100 Subject: [PATCH] Create 'tenders_update_status_to_rejected' script and add it to cron --- clevercloud/cron.json | 3 ++- .../tenders_update_status_to_rejected.sh | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 clevercloud/tenders_update_status_to_rejected.sh diff --git a/clevercloud/cron.json b/clevercloud/cron.json index 9a85f2c18..730ee0b27 100644 --- a/clevercloud/cron.json +++ b/clevercloud/cron.json @@ -20,5 +20,6 @@ "35 8 * * * $ROOT/clevercloud/tenders_send_siae_transactioned_question_emails.sh", "0 9 * * * $ROOT/clevercloud/tenders_send_siae_contacted_reminder_emails.sh", "10 9 * * * $ROOT/clevercloud/tenders_send_siae_interested_reminder_emails.sh", - "*/5 8-15 * * 1-5 $ROOT/clevercloud/tenders_send_validated.sh" + "*/5 8-15 * * 1-5 $ROOT/clevercloud/tenders_send_validated.sh", + "0 23 * * * $ROOT/clevercloud/tenders_update_status_to_rejected.sh" ] \ No newline at end of file diff --git a/clevercloud/tenders_update_status_to_rejected.sh b/clevercloud/tenders_update_status_to_rejected.sh new file mode 100644 index 000000000..82aefb858 --- /dev/null +++ b/clevercloud/tenders_update_status_to_rejected.sh @@ -0,0 +1,22 @@ +#!/bin/bash -l + +# Update Tenders' status to rejected if no changes whitin 10 days since modification request + +# Do not run if this env var is not set: +if [[ -z "$CRON_TENDER_UPDATE_STATUS_TO_REJECTED_ENABLED" ]]; then + echo "CRON_TENDER_UPDATE_STATUS_TO_REJECTED_ENABLED not set. Exiting..." + exit 0 +fi + +# About clever cloud cronjobs: +# https://developers.clever-cloud.com/doc/administrate/cron/ + +if [[ "$INSTANCE_NUMBER" != "0" ]]; then + echo "Instance number is ${INSTANCE_NUMBER}. Stop here." + exit 0 +fi + +# $APP_HOME is set by default by clever cloud. +cd $APP_HOME + +django-admin update_tender_status_to_rejected \ No newline at end of file