new-site/scripts/ops/carbonio/nr_cron_install.sh
justin 2d220a273d ops(carbonio): add noreply@ mailbox auto-purge + daily cron
Server-side classifier for the noreply@performancewest.net Carbonio mailbox
(35,337 msgs, ~98.6% machine noise). Deletes bounces/auto-replies/ticket
auto-acks, keeps genuine human Re: replies + unsubscribes (move to Trash,
reversible).

Classifier precedence: unsubscribe guard > RFC3834 Auto-Submitted header >
machine From-address (localpart/strong-token/display-bot) > STRONG auto
subjects (deletes deceptive Re: auto-acks) > human Re: keep > broad auto-ack
subjects > default keep. Subjects RFC2047 MIME-decoded first.

Three-phase execution: Phase1 fast MAILER-DAEMON search-delete, Phase1.5 fast
search-delete of common auto classes (guarded against Re:/unsub), Phase2
header-classify the small remainder with KEEP-caching.

Validated 23/23 against hand-labelled live sample. Initial backfill reduced
35,337 -> 68 (67 human replies + 1 unsubscribe). Daily cron installed in root
crontab: 17 4 * * * --apply --days 3.
2026-06-21 04:55:50 -05:00

10 lines
578 B
Bash

#!/bin/bash
# Install daily noreply@ auto-purge cron in ROOT crontab (NOT zextras' -- that one is
# regenerated by Carbonio/zmcontrol and would wipe our line). Root crontab is stable.
# Invokes the purge as the zextras user. Date-bounded (last 3 days) so it stays cheap.
set -e
SCRIPT=/opt/zextras/nr_purge.sh
LOG=/var/log/nr_purge_cron.log
CRON_LINE="17 4 * * * su - zextras -c 'bash $SCRIPT --apply --days 3' >> $LOG 2>&1"
( crontab -l 2>/dev/null | grep -v 'nr_purge.sh' ; echo "$CRON_LINE" ) | crontab -
echo "=== root crontab nr_purge line ==="; crontab -l | grep nr_purge