#!/bin/sh # # This file cleans up SA-Exim greylisting tuplets # You should install this file in /etc/cron.hourly # Delete Greylisted entries that we deem too old (two days) # alternate way to delete, slightly more secure, but not needed anymore now # that filenames are cleaned up #find /var/spool/sa-exim/tuplets/ -type f -mmin +2880 -exec bash -c 'grep -q "Status: Greylisted" "{}" && /bin/rm "{}"' \; # Uncomment these 2 lines if you want an hourly cron mail with the greylist # removes #echo "Greylist removes" #find /var/spool/sa-exim/tuplets/ -type f -mmin +2880 -print0 | xargs -0 grep "Status: Greylisted" | sed "s/:Status: Greylisted//" find /var/spool/sa-exim/tuplets/ -type f -mmin +2880 -print0 | xargs -0 grep "Status: Greylisted" | sed "s/:Status: Greylisted//" | xargs -r rm # Delete all entries older than 2 weeks # Uncomment these 2 lines if you want an hourly cron mail with the whitelist # removes #echo "Whitelist removes" #find /var/spool/sa-exim/tuplets/ -type f -mtime +14 -print find /var/spool/sa-exim/tuplets/ -type f -mtime +14 -print0 | xargs -r0 rm # Clean empty directories find /var/spool/sa-exim/tuplets/ -type d -print0 | xargs -r0 rmdir 2>/dev/null exit 0