[Mimedefang] cron script to archive MD-Quarantine

Matthew.van.Eerde at hbinc.com Matthew.van.Eerde at hbinc.com
Wed Sep 29 14:32:27 EDT 2004


Matthew.van.Eerde wrote:
> My /var/spool/MD-Quarantine directory starts to get full
> after a while.
> 
> I'm thinking of writing a cron.monthly script.

Here's what I came up with:
mkdir /var/spool/MD-Quarantine-Archive
chown defang:defang /var/spool/MD-Quarantine-Archive
chmod 750 /var/spool/MD-Quarantine-Archive
cat > /etc/cron.monthly/md-quarantine-archive
(paste the following)
#!/bin/sh
# This archives all MIMEDefang-quarantined email over 31 days old

# archive everything more than 31 days old
find /var/spool/MD-Quarantine -maxdepth 1 -daystart -mtime +31 | xargs tar czvf /var/spool/MD-Quarantine-Archive/31-days-before-`date --iso-8601`.tar.gz

# now delete everything more than 31 days old
find /var/spool/MD-Quarantine -maxdepth 1 -daystart -mtime +31 | xargs rm -rf

exit 0
^C
chmod a+x /etc/cron.monthly/md-quarantine-archive

Matthew.van.Eerde at hbinc.com                      805.964.4554 x902
Hispanic Business Inc./HireDiversity.com         Software Engineer
perl -e"map{y/a-z/l-za-k/;print}shift" "Jjhi pcdiwtg Ptga wprztg,"



More information about the MIMEDefang mailing list