#!/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