[Mailman-Users] My MHonArc configuration

Joseph Gray jgray at lcdfnm.org
Wed Jul 5 18:05:23 CEST 2000


This is a followup to my posting about how I had MHonArc configured with Mailman. After some suggestions from others on the list, I
have changed things substantially. Here is my present configuration. Be careful of any word wrapping that my email client may have
done to the following lines.

-----

First, I define the external archiver in "mm_cfg.py". Note that I am calling a wrapper script and not MHonArc directly.

PUBLIC_EXTERNAL_ARCHIVER = "/home/mailman/ext-archiver %(listname)s"
PRIVATE_EXTERNAL_ARCHIVER = "/home/mailman/ext-archiver %(listname)s"

-----

Here is the wrapper script itself. Since this script is called each time a message is archived, it checks to see if a directory for
the current month exists. If not, a new month's directory is created and at that time, the "index.html" file is updated to list the
directories containing each month's archive. I didn't want to let the Apache web server automatically index these directories, since
they are in the "private" directory. I also wanted to control the format of the web page listing. I am no shell script expert, so if
anyone sees a problem with this, please let me know.

#!/bin/sh

# 2 Jul 2000 Joe Gray - /home/mailman/ext-archiver
# Wrapper script to make MHonArc create monthly archives.

umask 022
LISTNAME=$1
MONTH_YEAR=`date +%B%Y`
LISTDIR=/home/mailman/archives/private/$LISTNAME
OUTDIR=$LISTDIR/$MONTH_YEAR
RCFILE=/home/mailman/mhonarc.mrc

# Make the monthly directory if it doesn't exist. Update the "index.html"
# file to reflect the added month.
if [ ! -d "$OUTDIR" ]; then
    mkdir -p $OUTDIR
    cd $LISTDIR
    ls -t -1 > dirlist
    grep -v 'dirlist' dirlist > newlist
    grep -v 'index.html' newlist > dirlist
    rm -f newlist
    echo '<html>' > index.html
    echo '<head>' >> index.html
    echo -n '<title>Monthly Archives of ' >> index.html
    echo -n $1 >> index.html
    echo '</title>' >> index.html
    echo '</head>' >> index.html
    echo '<body>' >> index.html
    echo -n '<h1>Monthly Archives of ' >> index.html
    echo -n $1 >> index.html
    echo '</h1>' >> index.html
    echo '<hr><pre>' >> index.html
    for I in `cat dirlist`; do
        echo -n '<a href="' >> index.html
        echo -n $I >> index.html
        echo -n '/">' >> index.html
        echo -n $I >> index.html
        echo '/</a>' >> index.html
    done
    echo '</pre><hr>' >> index.html
    echo '</body></html>' >> index.html
fi

/usr/local/bin/mhonarc -add -rcfile $RCFILE -outdir $OUTDIR

-----

Here is my "mhonarc.mrc" resource file.

<!-- MHonArc Resource File -->
<!-- 28 Jun 2000 Joe Gray - /home/mailman/mhonarc.mrc -->

<!-- Set umask -->
<UMASK>
022
</UMASK>

<!-- Set the main archive HTML page name. -->
<IDXFNAME>
index.html
</IDXFNAME>

<!-- Don't save resources in database since we invoke with resource file. -->
<NOSAVERESOURCES>

<!-- Break index into multiple pages with 20 messages per page. -->
<MULTIPG>

<IDXSIZE>
20
</IDXSIZE>

<!-- Since MULTIPG is on, add more navigation links to Main index page.
<ListBegin>
<ul>
<li><a href="$TIDXFNAME$">Thread Index</a></li>
</ul>
<table width="100%" border=0 cols=2 cellpadding=0 cellspacing=0>
<tbody>
<tr align="center">
<th colspan=4>Page $PAGENUM$ of $NUMOFPAGES$
<tr>
<td align="left">$PGLINK(PREV)$
<td align="right">[<a href="$PG(FIRST)$">First Page</a>]
<td align="left">[<a href="$PG(LAST)$">Last Page</a>]
<td align="right">$PGLINK(NEXT)$
</tbody>
</table>
<hr>
<ul>
</ListBegin>

<!-- Since MULTIPG is on, add more navigation links to Threaded index page.
<THead>
<ul>
<li><a href="$IDXFNAME$">Date Index</a></li>
</ul>
<table width="100%" border=0 cols=2 cellpadding=0 cellspacing=0>
<tbody>
<tr align="center">
<th colspan=4>Page $PAGENUM$ of $NUMOFPAGES$
<tr>
<td align="left">$PGLINK(TPREV)$
<td align="right">[<a href="$PG(TFIRST)$">First Page</a>]
<td align="left">[<a href="$PG(TLAST)$">Last Page</a>]
<td align="right">$PGLINK(TNEXT)$
</tbody>
</table>
<hr>
<ul>
</THead>

<!-- Specify date sorting. -->
<Sort>

<!-- Set mod time of the HTML message to the time the message was sent. -->
<MODTIME>

<!-- Show only these fields in the message header. -->
<FieldOrder>
to
from
date
reply-to
</FieldOrder>

<!-- Change main index title to reflect date sorting. -->
<TITLE>
Mailing List Archive (by Date)
</TITLE>

<!-- Change threaded index title to reflect threading. -->
<TTITLE>
Mailing List Archive (Threaded)
</TTITLE>

<!-- Change format of Date Index listing. -->
<LiTemplate>
<li><strong>$SUBJECT$</strong> -
<em> $YYYYMMDD$ - $FROMNAME$</em>
</li>
</LiTemplate>

<!-- Change format of Thread Index listing. -->
<TLiTxt>
<li><strong>$SUBJECT$</strong> -
<em> $FROMNAME$</em>
</TLiTxt>

<!-- Force plain text messages to wordwrap. -->
<MIMEargs>
text/plain;maxwidth=80
</MIMEargs>

-----





More information about the Mailman-Users mailing list