From 9b999420f4d915c7903ecf17b5aa9d1c888a33be Mon Sep 17 00:00:00 2001 From: Jonas Carson Date: Tue, 14 Mar 2023 12:26:20 -0700 Subject: [PATCH 1/2] Add django env activation scripts and crontabs to run anvil audits --- gregor-apps-activate.sh | 7 +++++++ gregor-apps-dev-activate.sh | 11 +++++++++++ gregor_apps.cron | 6 ++++++ gregor_apps_dev.cron | 7 +++++++ 4 files changed, 31 insertions(+) create mode 100644 gregor-apps-activate.sh create mode 100644 gregor-apps-dev-activate.sh create mode 100644 gregor_apps.cron create mode 100644 gregor_apps_dev.cron diff --git a/gregor-apps-activate.sh b/gregor-apps-activate.sh new file mode 100644 index 00000000..efa72f9c --- /dev/null +++ b/gregor-apps-activate.sh @@ -0,0 +1,7 @@ +export DJANGO_SITE_DIR=/var/www/django/gregor_apps/ +export DJANGO_SITE_USER=gregorweb +export DJANGO_SETTINGS_MODULE=config.settings.apps +export DJANGO_WSGI_FILE=config/gregor_apps_wsgi.py +export GAC_ENV=gregor_apps +cd $DJANGO_SITE_DIR +. venv/bin/activate diff --git a/gregor-apps-dev-activate.sh b/gregor-apps-dev-activate.sh new file mode 100644 index 00000000..40779e73 --- /dev/null +++ b/gregor-apps-dev-activate.sh @@ -0,0 +1,11 @@ +# Sets environment variables, changes directory and activates venv +# for gregor apps dev env +# Used by crontab, validate any changes + +export DJANGO_SITE_DIR=/var/www/django/gregor_apps_dev/ +export DJANGO_SITE_USER=gregorweb +export DJANGO_SETTINGS_MODULE=config.settings.apps_dev +export DJANGO_WSGI_FILE=config/apps_dev_wsgi.py +export GAC_ENV=gregor_apps_dev +cd $DJANGO_SITE_DIR +. venv/bin/activate diff --git a/gregor_apps.cron b/gregor_apps.cron new file mode 100644 index 00000000..c5cf4390 --- /dev/null +++ b/gregor_apps.cron @@ -0,0 +1,6 @@ +# GREGOR_APPS crontab +# nightly except sunday at 00:00 +0 0 * * MON-SAT . /var/www/django/gregor_apps/gregor-apps-activate.sh; python manage.py run_anvil_audit --email gregorconsortium@uw.edu --errors-only >> cron.log 2>&1 + +# sunday night at 00:00 +0 0 * * SUN . /var/www/django/gregor_apps/gregor-apps-activate.sh; python manage.py run_anvil_audit --email gregorconsortium@uw.edu >> cron.log 2>&1 diff --git a/gregor_apps_dev.cron b/gregor_apps_dev.cron new file mode 100644 index 00000000..557293d1 --- /dev/null +++ b/gregor_apps_dev.cron @@ -0,0 +1,7 @@ +# GREGOR_APPS_DEV crontab - disabled by default +# can be enabled for testing. +# nightly except sunday at 00:00 +# 0 0 * * MON-SAT . /var/www/django/gregor_apps/gregor-apps-dev-activate.sh; python manage.py run_anvil_audit --email gregorconsortium@uw.edu --errors-only >> cron.log 2>&1 + +# sunday night at 00:00 +# 0 0 * * SUN . /var/www/django/gregor_apps/gregor-apps-dev-activate.sh; python manage.py run_anvil_audit --email gregorconsortium@uw.edu >> cron.log 2>&1 From b6f2c31a8b62d3566a2134202ce302ce76fd2105 Mon Sep 17 00:00:00 2001 From: Jonas Carson Date: Tue, 14 Mar 2023 12:28:48 -0700 Subject: [PATCH 2/2] Fix trailing whitespace --- gregor_apps.cron | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gregor_apps.cron b/gregor_apps.cron index c5cf4390..1f8e1e7f 100644 --- a/gregor_apps.cron +++ b/gregor_apps.cron @@ -1,4 +1,4 @@ -# GREGOR_APPS crontab +# GREGOR_APPS crontab # nightly except sunday at 00:00 0 0 * * MON-SAT . /var/www/django/gregor_apps/gregor-apps-activate.sh; python manage.py run_anvil_audit --email gregorconsortium@uw.edu --errors-only >> cron.log 2>&1