mhonarc-users

Tip on month archiving

1998-10-23 04:18:06

Hi all,

Enclosed a little .procmailrc and shell script to 
archive lists by month using MHonArc & procmail

Regards,

PD: I use X-Mailing-List header in the recipe, but that´s
something I would like people comment on. Maybe Resent-From ?

--
Alvaro Fdez. Lago
Hospital Xeral de Vigo, Spain
alago(_at_)unicies(_dot_)cesga(_dot_)es


.procmailrc:
-----------

PATH=/bin:/usr/bin:/usr/local/bin

dir=/usr/local/apache/share/htdocs/lists

t=`date +%Y-%m`

:0:
* ^(X-Mailing-List: \/(.+))
* !^Subject:.*Digest
| (umask 022; export list=`expr "$MATCH" : "\(.*\)@"`;   \
   test -d $dir/$list || mkdir $dir/$list;               \
   test -d $dir/$list/$t || mkdir $dir/$list/$t;         \
   mhonarc -add -quiet -rcfile /tmp/test.rc              \
     -outdir $dir/$list/$t -umask 022;                   \
     reindex $list $t)


reindex:
--------

umask 022 # just to be sure!

cd /usr/local/apache/share/htdocs/list/$1

fic=index.html

cat - <<EOF 1>$fic
<HTML>
<TITLE>List archive for: $1</TITLE>
<BODY>
<HR>
<UL>
EOF

dv=`ls -dt [0-9]*`
for i in $dv
do
        nfiles=`ls -l $i/msg*.html | wc -l`
        cat - <<EOF 1>>$fic
<LI><B>$i ($nfiles msg.):</B>
 &#160; <A HREF="/lists/$1/$i/maillist.html">[Index]</A>
 &#160; <A HREF="/lists/$1/$i/threads.html">[Thread]</A>
EOF
done

cat - <<EOF 1>>$fic
</UL>
<HR>
</BODY>
</HTML>
EOF


~

<Prev in Thread] Current Thread [Next in Thread>