From 9fa2c86f0127c8b8c123c2c3013c3dace6911d80 Mon Sep 17 00:00:00 2001 From: justin Date: Tue, 9 Jun 2026 16:06:28 -0500 Subject: [PATCH] fix(warmup): HC cron logged to /var/log (deploy can't write) -> cron silently died The HC warmup builder ran from cron at 07:00 but the >> /var/log/pw-hc-campaign.log redirect failed (deploy user cannot write /var/log), and a failed output redirect makes cron abort the command BEFORE it runs -> HC sent 0/day since the log file was removed. Route HC cron logs to /opt/performancewest/logs/ (deploy-owned) so the redirect always succeeds. Builder itself was fine (verified: imports + sends work, 0 bounces). Also removed the stale 'campaign-warmup.sh 122' root-cron line that pointed at a finished campaign + no longer existed. --- infra/cron/pw-hc-campaign | 5 ++++- infra/cron/pw-hc-refresh | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/infra/cron/pw-hc-campaign b/infra/cron/pw-hc-campaign index 4635535..8dc1a1d 100644 --- a/infra/cron/pw-hc-campaign +++ b/infra/cron/pw-hc-campaign @@ -1,3 +1,6 @@ +# NOTE: logs go to /opt/performancewest/logs/ (deploy-owned). The deploy user +# cannot write /var/log, so a /var/log redirect makes cron silently fail before +# the command runs. Ensure /opt/performancewest/logs exists + is deploy-owned. # Healthcare warmup: import the next slice across ALL active segments # (revalidation, OIG screening, NPPES, reactivation, bundle) into listmonk-hc # and keep each campaign running. Mon-Fri only, 7 AM Central (host TZ = @@ -7,4 +10,4 @@ # Deliverability guard: warmup only mails SLIGHTLY-overdue providers (1-90 days # by default, HC_OVERDUE_MIN/MAX) -- recently-lapsed practices still have live # inboxes; heavily-overdue ones likely bounce and burn the warming IPs. -0 7 * * 1-5 deploy cd /opt/performancewest && HC_VERIFIED_CSV=/opt/performancewest/data/hc_warmup_nongoogle.csv python3 scripts/build_healthcare_campaigns_cron.py --start-campaign >> /var/log/pw-hc-campaign.log 2>&1 +0 7 * * 1-5 deploy cd /opt/performancewest && HC_VERIFIED_CSV=/opt/performancewest/data/hc_warmup_nongoogle.csv python3 scripts/build_healthcare_campaigns_cron.py --start-campaign >> /opt/performancewest/logs/pw-hc-campaign.log 2>&1 diff --git a/infra/cron/pw-hc-refresh b/infra/cron/pw-hc-refresh index 0e5f7e5..64559a5 100644 --- a/infra/cron/pw-hc-refresh +++ b/infra/cron/pw-hc-refresh @@ -1,3 +1,6 @@ +# NOTE: logs go to /opt/performancewest/logs/ (deploy-owned). The deploy user +# cannot write /var/log, so a /var/log redirect makes cron silently fail before +# the command runs. Ensure /opt/performancewest/logs exists + is deploy-owned. # Healthcare data refresh: re-check every emailable NPI against the live # government sources (CMS Revalidation list, OIG LEIE) + MX re-classification # (Google-host detection) so warmup sends never go stale. Runs Mon/Wed/Fri 06:00 @@ -7,4 +10,4 @@ # Takes ~8 min. SAM is opt-in (--sam-pages); SAM exclusions rarely carry an NPI, # so OIG LEIE is the NPI-bearing exclusion source. Then prune-only removes newly- # Google-hosted and suppressed subscribers from the warmup lists. -0 6 * * 1,3,5 deploy cd /opt/performancewest && python3 -u scripts/hc_data_refresh.py >> /var/log/pw-hc-refresh.log 2>&1 && python3 -u scripts/build_healthcare_campaigns_cron.py --prune-only >> /var/log/pw-hc-refresh.log 2>&1 +0 6 * * 1,3,5 deploy cd /opt/performancewest && python3 -u scripts/hc_data_refresh.py >> /opt/performancewest/logs/pw-hc-refresh.log 2>&1 && python3 -u scripts/build_healthcare_campaigns_cron.py --prune-only >> /opt/performancewest/logs/pw-hc-refresh.log 2>&1