Deleting messages "marked for deletion" older than X days

Adam Tauno Williams adam at morrison-ind.com
Tue Aug 19 08:40:04 EDT 2008


On Tue, 2008-08-19 at 10:05 +1000, Bron Gondwana wrote:
> On Mon, Aug 18, 2008 at 05:09:53PM -0500, Kenneth Marshall wrote:
> > In the manual page, the definition of the '-X' option seems to
> > do what you want:
> > 
> >       -X expunge-days
> >               Expunge  previously deleted messages older than expunge-days
> >               (when using the "delayed" expunge mode).  The default is
> >               0 (zero) days, which will expunge all previously deleted messages.
> Now, what the -X option actually does is turns this into:
> but the file is still on disk, just the index record has been moved
> from the file cyrus.index to a new file cyrus.expunge.  A week later:
> Cleaned up (no file)     - cyr_expire -X 7
> The cyrus.expunge record and the actual spool file itself get deleted at
> this point.  Until then you can un-delete the record using the
> "unexpunge" command in cyrus 2.3.X.

I'm working on data-retention for my employer and I was wondering about
this.  The wording is a bit vague in the manual page (we are now using
deleted to mean multiple things...).   I have assumed that "-X 7" means
purge-the-message-seven-days-AFTER-IT-WAS-"EXPUNGED".  Is this correct?
I believe the manual page could also be read to mean
purge-the-message-AFTER-IT-WAS-"EXPUNGED"-AND-IS-OLDER-THAN-SEVEN-DAYS.
"OLDER-THAN-SEVEN-DAYS" meaning it was received more than seven days
ago [equivalent to "ipurge -d 7 -X"].  

> I think what the original requestor was actually looking for is a tool
> that can run the "EXPUNGE" phase on a regular basis.  As far as I'm
> aware there's nothing that ships with Cyrus that can do it.  If I was
> writing something for the job I would make an admin IMAP connection to
> Cyrus and just cycle through the folders calling 'EXPUNGE' on them.
> Cheap and nasty, but it would do the trick.  You can do this in any
> language with a TCP library, though something with an IMAP interface
> library would be nicer.  I'd use Perl and Mail::IMAPTalk, but that's
> just because that's what I already use!

I'd do it in python. :)  I've done some similar things for walking the
entire mailstore and building statistics, etc...  but it is REALLY slow!
A server side API for making tools like cyr_expire would be really nice.



More information about the Info-cyrus mailing list