File tree Expand file tree Collapse file tree 3 files changed +21
-5
lines changed
django/demsausage/app/sausage/cron Expand file tree Collapse file tree 3 files changed +21
-5
lines changed Original file line number Diff line number Diff line change 88from demsausage .app .enums import StallStatus # noqa: E402
99from demsausage .app .models import Stalls # noqa: E402
1010from demsausage .app .sausage .mailgun import ( # noqa: E402
11- send_monthly_reminder_heartbeat_email , send_pending_stall_reminder_email )
11+ send_monthly_reminder_heartbeat_email ,
12+ send_pending_stall_reminder_email ,
13+ )
1214
15+ print ("Sending monthly reminder heartbeat email..." )
1316send_monthly_reminder_heartbeat_email ()
17+ print ("Monthly reminder heartbeat email sent" )
1418
19+ print ("Checking for pending stalls..." )
1520pending_stall_count = Stalls .objects .filter (status = StallStatus .PENDING ).count ()
21+ print (f"Found { pending_stall_count } pending stall(s)" )
1622
1723if pending_stall_count > 0 :
24+ print (f"Sending pending stall reminder email for { pending_stall_count } stall(s)..." )
1825 try :
1926 send_pending_stall_reminder_email (pending_stall_count )
27+ print ("Pending stall reminder email sent successfully" )
2028 except Exception as e :
21- print (e )
29+ print (f"Error sending pending stall reminder email: { e } " )
30+ else :
31+ print ("No pending stalls, skipping reminder email" )
2232
23- print ("Fin " )
33+ print ("Cron job finished successfully " )
Original file line number Diff line number Diff line change 11#! /bin/bash
22
3- /usr/local/bin/python /app/demsausage/app/sausage/cron/cron.py
3+ echo " [$( date ' +%Y-%m-%d %H:%M:%S' ) ] Starting cron job"
4+ /usr/local/bin/python /app/demsausage/app/sausage/cron/cron.py
5+ echo " [$( date ' +%Y-%m-%d %H:%M:%S' ) ] Cron job completed"
Original file line number Diff line number Diff line change 11SHELL=/bin/bash
22BASH_ENV=/app/demsausage/app/sausage/cron/demsausage.cron.env
3- 0 12 * * * /app/demsausage/app/sausage/cron/cron.sh >> /app/logs/cron/cron_output.log 2>&1
3+
4+ # Daily cron job at midnight (00:00 UTC)
5+ # - Sends monthly reminder heartbeat email
6+ # - Checks for pending stalls and sends reminder emails if any exist
470 0 * * * /app/demsausage/app/sausage/cron/cron.sh >> /app/logs/cron/cron_output.log 2>&1
8+
59# Do not remove this new line, cron needs it
You can’t perform that action at this time.
0 commit comments