Monday, June 12, 2006

Archive your mailing lists

Using mhonarc:

First, urpmi it and its dependencies:

[root@flanders snapshots]# urpmi mhonarc
To satisfy dependencies, the following 6 packages are going to be installed (9 MB):
MHonArc-2.6.10-1mdk.noarch
perl-Jcode-0.86-2mdk.i586
perl-Unicode-Map-0.112-4mdk.i586
perl-Unicode-Map8-0.12-5mdk.i586
perl-Unicode-MapUTF8-1.09-4mdk.noarch
perl-Unicode-String-2.07-4mdk.i586
Is this OK? (Y/n)

ftp://mirrors.usc.edu/pub/linux/distributions/mandrakelinux/official/2005/i586/media/main/perl-Unicode-String-2.07-4mdk.i586.rpm
ftp://mirrors.usc.edu/pub/linux/distributions/mandrakelinux/official/2005/i586/media/main/MHonArc-2.6.10-1mdk.noarch.rpm
ftp://mirrors.usc.edu/pub/linux/distributions/mandrakelinux/official/2005/i586/media/contrib/perl-Unicode-Map-0.112-4mdk.i586.rpm
ftp://mirrors.usc.edu/pub/linux/distributions/mandrakelinux/official/2005/i586/media/contrib/perl-Unicode-MapUTF8-1.09-4mdk.noarch.rpm
ftp://mirrors.usc.edu/pub/linux/distributions/mandrakelinux/official/2005/i586/media/contrib/perl-Jcode-0.86-2mdk.i586.rpm
ftp://mirrors.usc.edu/pub/linux/distributions/mandrakelinux/official/2005/i586/media/contrib/perl-Unicode-Map8-0.12-5mdk.i586.rpm
installing perl-Unicode-String-2.07-4mdk.i586.rpm perl-Unicode-MapUTF8-1.09-4mdk.noarch.rpm perl-Unicode-Map-0.112-4mdk.i586.rpm perl-Jcode-0.86-2mdk.i586.rpm perl-Unicode-Map8-0.12-5mdk.i586.rpm MHonArc-2.6.10-1mdk.noarch.rpm from /var/cache/urpmi/rpms
Preparing... #############################################
1/6: perl-Unicode-String #############################################
2/6: perl-Unicode-Map8 #############################################
3/6: perl-Jcode #############################################
4/6: perl-Unicode-Map #############################################
5/6: perl-Unicode-MapUTF8 #############################################
6/6: MHonArc #############################################


Then look for documentation ... google it, and here we go...
The big one:
http://www.mhonarc.org/MHonArc/doc/index.html

The quickstart:
http://www.mhonarc.org/MHonArc/doc/quickstart.html#folders

Ok, we have some infos...

[bsergean@flanders ~]$ cd public_html/
[bsergean@flanders public_html]$ mkdir mailarchives
[bsergean@flanders public_html]$ cd mailarchives
[bsergean@flanders mailarchives]$ mhonarc -outdir . ~bsergean/mail/admin
This is MHonArc v2.6.10, Perl 5.008006 linux
Converting messages to .
Reading /home/bsergean/mail/admin ................................................................................

Writing mail ...............................................................................
Writing ./maillist.html ...
Writing ./threads.html ...
Writing database ...
79 new messages
79 total messages

And from the doc, we can guess which url we will give to firefox:

MHonArc creates the following files after processing the mail folders:

* maillist.html: The main index file containing links to all mail messages converted. Messages are listed with subjects and who the messages are from. All messages are listed by the date.
* threads.html: The file listing messages by threads.
* msg*.html: HTML versions of the mail messages, where * represents a message number from 0 to the number of message processed minus 1.
* .mhonarc.db (or mhonarc.db under Windows): This database file contains archive information and resource settings for MHonArc to perform further updates.

Other: If messages contain attachments, other files may be created for images, videos, binaries, etc.

Here we are... the url for me will be
http://myhostname/~bsergean/mailarchives/threads.html

Now the fun thing is to subscribe to a big bandwidth mailing list, and then update this archive nightly for example.

First, I create a procmail filter:
# automatic build mails
:0:
* ^Subject:.*Unix nightly builds
uxbuilds

I create this uxbuilds folder with my emailer (pine).

Then, a crontab:
Edit it with crontab -e, and add this line:
0 7 * * 1-5 /share/common/bin/mypipermail.sh

And here is a dummy script which do the job.

#!/bin/sh

# html output prefix
hprefix=~/public_html/mailarchives
# mail prefix
mprefix=~/mail

# maildirs to archives
mdirs="
uxbuilds
"

for md in $mdirs
do
hdir=$hprefix/$md
test -d $hdir || mkdir -p $hdir

mdir=$mprefix/$md
if test ! -f $mdir ; then
echo "No such maildir: $mdir"
continue
fi

mhonarc -add -outdir $hdir $mdir
done


Enjoy !!

0 Comments:

Post a Comment

<< Home