diff --git a/clevercloud/cron.json b/clevercloud/cron.json index b2c546363..e616e52e4 100644 --- a/clevercloud/cron.json +++ b/clevercloud/cron.json @@ -15,5 +15,6 @@ "30 8 * * * $ROOT/clevercloud/tenders_send_author_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", - "20 9 * * * $ROOT/clevercloud/tenders_send_author_incremental.sh" + "20 9 * * * $ROOT/clevercloud/tenders_send_author_incremental.sh", + "*/5 9-17 * * 1-5 $ROOT/clevercloud/tenders_send_validated.sh" ] \ No newline at end of file diff --git a/clevercloud/tenders_send_validated.sh b/clevercloud/tenders_send_validated.sh new file mode 100755 index 000000000..d53336dcb --- /dev/null +++ b/clevercloud/tenders_send_validated.sh @@ -0,0 +1,22 @@ +#!/bin/bash -l + +# Send Tenders who are validated but not sent + +# Do not run if this env var is not set: +if [[ -z "$CRON_TENDER_SEND_VALIDATED_ENABLED" ]]; then + echo "CRON_TENDER_SEND_VALIDATED_ENABLED not set. Exiting..." + exit 0 +fi + +# About clever cloud cronjobs: +# https://www.clever-cloud.com/doc/tools/crons/ + +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 send_validated_tenders diff --git a/lemarche/tenders/management/commands/send_validated_tenders.py b/lemarche/tenders/management/commands/send_validated_tenders.py index 3b8656538..bc0af2b41 100644 --- a/lemarche/tenders/management/commands/send_validated_tenders.py +++ b/lemarche/tenders/management/commands/send_validated_tenders.py @@ -8,6 +8,10 @@ class Command(BaseCommand): """ Command to send validated tenders + Note: run via a CRON + "*/5 9-17 * * 1-5" = Every 5 minutes from 9am through 5pm on Monday through Friday + https://cron.help/#*/5_9-17_*_*_1-5 + Usage: python manage.py send_validated_tenders """