Re: [Exim] Cleaning old mail

Top Page
Delete this message
Reply to this message
Author: Ephraim Silverberg
Date:  
To: Leonardo Boselli
CC: Exim Mailing List
Subject: Re: [Exim] Cleaning old mail
>> Not exim specific, but very closely related:
>> Do exist some program that allow the administratot to clean the
>> users mailbox in /var/spool/mail from any message older than a
>> certain date, that is:
>> # /usr/sbin/sweep 2000-04-01 username1 [username2] [...]
>
> If you find such a programme, remember to use exim_lock when you run it,
> to stop Exim trying to deliver new messages while you are cleaning.


My perl script does what you want with a bit different command line:

    expiremessages [-d] [-n] mailfolder expiration_time


It is meant to be run in conjunction with 'find' so it only takes
one mail spool file. It tries to emulate Exim file (*not* fcntl)
locking, but this can be nullified by specifying '-n' ("nolocking")
and using the exim_lock wrapper suggested.

Expiration time is qualified by one of 'h' (hours), 'd' (days), 'w' (weeks)
or 'm' (months).

The debugging '-d' option reports how many messages need to be expired
without actually doing anything.

An example of its usage would be:

find /var/spool/mail -type f -exec exim_lock -q {} expiremessages -n {} 2m \;

Such a command could be run nightly from the crontab.  The script can be
found at "ftp://ftp.cs.huji.ac.il/pub/mail/exim/local/expiremessages".
___________________________________________________________________________
Ephraim Silverberg, CSE System Group,        Phone number:    972-2-6585521
Hebrew University, Jerusalem, Israel.        Fax number:      972-2-6585439
WWW: http://www.cs.huji.ac.il/~ephraim       E-mail: ephraim@???