On Thursday 06 July 2006 17:40, Ian P. Christian wrote:
> Hi all,
>
> I want to do a database cleanup in my exim config, so there's a 1 in 10,000
> chance some SQL will be run - I could cron it, but I prefer the config to
> be self-contained.
Chris - thanks for the patch, however - I don't want to start rolling my own
patch sets unless I can really avoid it, so I've done it all in SQL, and
here's how:
DO_CLEANUP = \
SELECT RAND()*1000 < 1;
CLEANUP_HELO = \
DELETE FROM exim_helo WHERE DATE_SUB(NOW(),INTERVAL 5 DAY) > created_at;
CLEANUP_SPAMSCORE = \
DELETE FROM exim_spam WHERE DATE_SUB(NOW(),INTERVAL 5 DAY) > created;
warn condition = ${lookup mysql{DO_CLEANUP}}
condition = ${lookup mysql{CLEANUP_HELO}}
condition = ${lookup mysql{CLEANUP_SPAMSCORE}}
log_message = [CLEANUP] Cleaning out data from the database
By the time this ACL is hit, exim has already done atleast one query, so it
will have connected to the database anyway. This perhaps isn't the nicest
solution (already peope have mailed the list saying I hsould do it elsewere)
but... I want just one place for everything exim database related, because
I'm lazy ;)
Thanks everyone!
--
Ian P. Christian
http://pookey.co.uk