Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-21 08:46:24

0001 #!/bin/bash
0002 # Cron wrapper for the campaign-assessment trigger
0003 # (swf-epicprod docs/EPICPROD_ASSESSMENTS_V1.md). Loads production.env —
0004 # the single source the agent and web tier read — and runs the deployed
0005 # trigger module. All args pass through (--kind nightly|weekly, ...).
0006 #
0007 # Install (wenauseic), after the 02:15 catalog_sync chain:
0008 #   45 3 * * *  /opt/swf-monitor/current/scripts/assessment-trigger-cron.sh --kind nightly
0009 #    0 6 * * 1  /opt/swf-monitor/current/scripts/assessment-trigger-cron.sh --kind weekly
0010 set -eo pipefail
0011 
0012 ENV_FILE="${EPICPROD_ENV_FILE:-/opt/swf-monitor/config/env/production.env}"
0013 PYTHON="${EPICPROD_PYTHON:-/opt/swf-monitor/current/.venv/bin/python}"
0014 
0015 # production.env is a Django/decouple env file, NOT a bash script: values may
0016 # contain $ & ( ) etc. unquoted (e.g. SECRET_KEY), so `source` chokes on them.
0017 # Parse it the way systemd's EnvironmentFile does — literal KEY=VALUE, no
0018 # shell evaluation — and export each for the trigger.
0019 if [ -f "$ENV_FILE" ]; then
0020     while IFS='=' read -r key val || [[ -n "$key" ]]; do
0021         [[ "$key" =~ ^[A-Za-z_][A-Za-z0-9_]*$ ]] || continue   # skip comments/blanks
0022         val="${val%\"}"; val="${val#\"}"                       # strip optional "quotes"
0023         export "$key=$val"
0024     done < "$ENV_FILE"
0025 fi
0026 
0027 exec "$PYTHON" -m swf_epicprod.assessment.trigger "$@"