[lug] Mail archiving solutions
David Morris
lists at morris-clan.net
Wed Jun 11 11:35:32 MDT 2003
On Tue, Jun 10, 2003 at 10:38:06PM -0600, Joseph Crotty wrote:
> On Tue, 10 Jun 2003, Peter Hutnick wrote:
>
> > > All of my email is carbon copied to a master archive mbox file by
> > > procmail. I would like to be able to run a cron job that calls a
> > > script, say weekly, that churns over the master archive file and sorts
> > > the mail into monthly files (e.g. 0603.mail).
I use a trick for my sent email you could adapt to the
purpose:
I use mutt as my email reader, and separate out my sent
email by month to sepperate files (one file per month). The
filename is automatically generated using command
"sent-mail/`hostname`-sent-mail-`date +%Y-%m`"
For a system named "myhost", this might generate:
sent-mail/myhost-sent-mail-2003-06
I don't know procmail well enough to know if you can have it
execute a command automatically in such a way, but if so you
could just generate the target file (or directory) in a
similar manner.
Another method to adapt this solution would be to create a
cron job that creates a new file and changes a sym-link at
the beginning of each month, then (if you want) does
processing on last month such as compressing it into a bzip2
archive. The problem with this method is that if you are
ever up dealing with email past midnight when that cron job
runs, you might get a few messages sorted to the wrong month
(I used to use this method and changed for this reason).
Hope this helps!
--David
More information about the LUG
mailing list