From e6ec42837ad07383581f9617acf8703244f43717 Mon Sep 17 00:00:00 2001 From: Allen Lee Date: Mon, 25 Mar 2024 15:31:26 -0700 Subject: [PATCH] fix: adjust scheduled tasks - use full path to /usr/sbin/autopostgresqlbackup - set django settings to production before backup tasks --- django/curator/invoke_tasks/database.py | 2 +- django/deploy/{cron.daily => cron.weekly}/clamav | 0 django/deploy/db/postgresql-backup-pre | 3 ++- 3 files changed, 3 insertions(+), 2 deletions(-) rename django/deploy/{cron.daily => cron.weekly}/clamav (100%) diff --git a/django/curator/invoke_tasks/database.py b/django/curator/invoke_tasks/database.py index c5a65cbc4..b2427073c 100644 --- a/django/curator/invoke_tasks/database.py +++ b/django/curator/invoke_tasks/database.py @@ -49,7 +49,7 @@ def create_pgpass_file(ctx, db_key=_DEFAULT_DATABASE, force=False): @task(aliases=["b"]) def backup(ctx): create_pgpass_file(ctx) - ctx.run("autopostgresqlbackup") + ctx.run("/usr/sbin/autopostgresqlbackup") @task(aliases=["r"]) diff --git a/django/deploy/cron.daily/clamav b/django/deploy/cron.weekly/clamav similarity index 100% rename from django/deploy/cron.daily/clamav rename to django/deploy/cron.weekly/clamav diff --git a/django/deploy/db/postgresql-backup-pre b/django/deploy/db/postgresql-backup-pre index 02151c8b6..40013af66 100755 --- a/django/deploy/db/postgresql-backup-pre +++ b/django/deploy/db/postgresql-backup-pre @@ -1,3 +1,4 @@ #!/bin/sh -/usr/local/bin/inv -r /code db.pgpass >> /shared/logs/db-backup.log 2>&1 +export DJANGO_SETTINGS_MODULE="core.settings.production" +/usr/local/bin/inv -r /code db.pgpass >> /shared/logs/prepare-db-backup.log 2>&1