Skip to content

Commit

Permalink
temporarily disable crontab for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Jul 7, 2024
1 parent 6781abc commit 3da5ee3
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 26 deletions.
2 changes: 2 additions & 0 deletions auctions/management/commands/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ def compare_model_instances(instance1, instance2):
class Command(BaseCommand):
help = 'Just a scratchpad to do things'
def handle(self, *args, **options):
user = User.objects.get(pk=1)
print(user.email)
# campaigns = AuctionCampaign.objects.all()
# for campaign in campaigns:
# campaign.update
Expand Down
45 changes: 23 additions & 22 deletions crontab
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
# m h dom mon dow command
# Set lots as ended and declare a winner
* * * * * /home/app/web/task.sh endauctions
* * * * * /home/app/web/task.sh info
@REM # Set lots as ended and declare a winner
@REM * * * * * /home/app/web/task.sh endauctions

# Send reminder emails about watched items
*/15 * * * * /home/app/web/task.sh sendnotifications
@REM # Send reminder emails about watched items
@REM */15 * * * * /home/app/web/task.sh sendnotifications

# welcome and print erminder emails
*/15 * * * * /home/app/web/task.sh auctiontos_notifications
@REM # welcome and print erminder emails
@REM */15 * * * * /home/app/web/task.sh auctiontos_notifications

# Email users about invoices
*/15 * * * * /home/app/web/task.sh email_invoice
@REM # Email users about invoices
@REM */15 * * * * /home/app/web/task.sh email_invoice

# Update leaderboard
* 23 * * * /home/app/web/task.sh update_breederboard
@REM # Update leaderboard
@REM * 23 * * * /home/app/web/task.sh update_breederboard

# send email
* * * * * /home/app/web/task.sh send_queued_mail
@REM # send email
@REM * * * * * /home/app/web/task.sh send_queued_mail

# send auction emails
*/4 * * * * /home/app/web/task.sh auction_emails
@REM # send auction emails
@REM */4 * * * * /home/app/web/task.sh auction_emails

# send notifications about unread chats
0 10 * * * /home/app/web/task.sh email_unseen_chats
@REM # send notifications about unread chats
@REM 0 10 * * * /home/app/web/task.sh email_unseen_chats

# weekly promo email sent on Wednesday
30 9 * * 3 /home/app/web/task.sh weekly_promo
@REM # weekly promo email sent on Wednesday
@REM 30 9 * * 3 /home/app/web/task.sh weekly_promo

# set user locations
0 0 * * * /home/app/web/task.sh set_user_location
@REM # set user locations
@REM 0 0 * * * /home/app/web/task.sh set_user_location

# check for duplicate page views
*/15 * * * * /home/app/web/task.sh remove_duplicate_views
@REM # check for duplicate page views
@REM */15 * * * * /home/app/web/task.sh remove_duplicate_views
2 changes: 1 addition & 1 deletion fishauctions/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
else:
DEBUG = True

ALLOWED_HOSTS = ['localhost', 'web', '127.0.0.1', '0.0.0.0', os.environ.get('ALLOWED_HOST_1', ''), os.environ.get('ALLOWED_HOST_2', ''), os.environ.get('ALLOWED_HOST_3', '')]
ALLOWED_HOSTS = ['localhost', 'web', '127.0.0.1', '0.0.0.0', os.environ.get('SITE_DOMAIN', ''), os.environ.get('ALLOWED_HOST_1', ''), os.environ.get('ALLOWED_HOST_2', ''), os.environ.get('ALLOWED_HOST_3', '')]
CSRF_TRUSTED_ORIGINS = ['http://localhost', 'http://127.0.0.1', 'https://' + os.environ.get('ALLOWED_HOST_1', ''), 'https://' + os.environ.get('ALLOWED_HOST_2', ''), 'https://' + os.environ.get('ALLOWED_HOST_3', '')]

# Channels
Expand Down
8 changes: 5 additions & 3 deletions task.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
#!/bin/bash

# This file is called by cron jobs, it sets up the env for them, and then calls python manage.py with the argument passed to it.

if [ $# -eq 0 ]; then
echo "No argument provided, specify which script to run" >> /var/log/cron.log 2>&1
echo "No argument provided, specify which script to run" > /proc/1/fd/1 2>&1
exit 1
fi

if [ -f /home/app/web/.env ]; then
export $(grep -v '^#' /home/app/web/.env | xargs)
else
echo "No .env file found, env will not be set" >> /var/log/cron.log 2>&1
echo "No .env file found, env will not be set" > /proc/1/fd/1 2>&1
fi

/usr/local/bin/python /home/app/web/manage.py $1 >> /var/log/cron.log 2>&1
/usr/local/bin/python /home/app/web/manage.py $1 > /proc/1/fd/1 2>&1

0 comments on commit 3da5ee3

Please sign in to comment.