procmail
[Top] [All Lists]

Re: archiving all but 100 newest messages to other folder

2001-04-17 13:16:42
On 04/17/2001, 19:17 +0200, Ben Peter wrote:
Hi,

Hi.

[...]
This would be a very handy thing for mailing lists for which I want to keep
the old messages, but want the mbox with the relevant messages small and
quick to access for pine (or balsa).

Another strategy:

 1/ archive each list messages in <list_name>.month ;

 2/ copy these messages in mbox.<list_name> ;

:0
* ^list-id: *\<procmail\>
{
   :0c:
   procmail.month

   :0:
   mbox.procmail
}

 3/ ...and a cron.monthly script resets mbox.<list_name>
with <list_name>.month, and rotates the archives, so you always
have between one and two months in your mboxes. On big lists, you
can operate weekly, if you don't mind breaking big trolls ;^)

#!/bin/sh
# ...of course, don't fetch mail while
# running on 1st day each month near 3am
/usr/bin/fetchmail -q

MONTH=`date +%Y-%m`

cd /<mailing lists directory>

for LIST in procmail <and other lists...>;do

 # resets mbox with last month archive
 cp -f ${LIST}.month mbox.${LIST}

 # creates new month archive,
 touch ${LIST}-${MONTH}

 # and links it.
 ln -sf  ${LIST}-${MONTH} ${LIST}.month

done

/usr/bin/fetchmail -d 900
# end

If you don't use fetchmail+procmail, close the connection during
the cron task, or use procmail locking on files.

Hope It Works, HTH,
--
Jacques L'helgoualc'h
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail