[Mailman-Users] Managing archives

Jon Carnes jonc at nc.rr.com
Wed Aug 13 07:39:26 CEST 2003


Alright, it worked great!

I have a list on one of my servers called "test", it has a lot of
messages in it, but nothing I care anything about. I used it to test
with...

I created an empty mbox on one of my imap accounts and called it "test"
then moved all the mbox information from the archives into the new imap
mbox:
  cat /var/mailman/archives/private/test.mbox/test.mbox >> test

This copied all the emails from the archive and left the imap header
information intact. 

The imap header is an "email" at the top of the file. The IMAP header is
created by Evolution (my email client) inside every IMAP mailbox that it
reads. The header is exactly 13 lines long. This seems to be fairly
standard for most IMAP clients.

All the messages in my test archive showed up as email messages in the
test mailbox.  I pruned out some messages and then copied the test mbox
back into the archive file. Next I edited the test.mbox file and removed
the imap header (which looks like the first email in the mbox - very
easy to recognize).

Next I deleted the old archives:
  rm -rf /var/mailman/archives/private/test/*

and generated the new archives:
  /var/mailman/bin/arch test

Viola! It worked great. My newly pruned archives looked fantastic, and
it was fast and easy.

It would be quite easy to automate this as two scripts, one that creates
the imap mbox and copies the mbox from the archive:
  #! /bin/bash
  #
  # Used to move an archive into position for editing
  # by anyone who can use an email client
  #
  # Assumptions: 
  #   - mailman install is in /var/mailman
  #   - imap mailbox root is /home/user/mail/<listname>
  #     This means that you already created the mbox
  #     using your email program.
  #       <listname> == $1
  #
  # Input: a valid mailman list name (with archives)
  #
  PATH2ARC="/var/mailman/archives/private"
  # Check that the list name is valid and the archives exist
  if [ ! -f $PATH2ARC/$1.mbox/$1.mbox ]; then
    echo ERROR: $1 is not a valid mailman list with archives
    echo   (be sure to use all lower case)
    echo   or path to archive files is incorrect:
    echo     $PATH2ARC
    echo " "
    exit 0
  fi
  #
  PATH2MB="/home/user/mail"
  #
  # Check that mbox has been created...
  if [ ! -f $PATH2MB/$1 ]; then
    echo ERROR: Please check that the path to your IMAP Mailbox
    echo   is: $PATH2MB  
    echo   and that you have created a Mailbox called:$1
    echo
    exit 0
  fi
  #
  cat $PATH2ARC/$1.mbox/$1.mbox >> $PATH2MB/$1
  
===

Now someone simply edits the mailbox using their email client. This
doesn't take anyone technically minded...

When they are done, we put back the archives:
  #! /bin/bash
  #
  # Used to move an edited mbox from an imap folder 
  # and put it back into the Mailman archive from
  # which it was grabbed.
  # 
  # Assumptions: 
  #   - mailman install is in /var/mailman,
  #     with archives being in /var/mailman/archives/private/..
  #   - imap mailbox root is /home/user/mail/<listname>
  #     and the imap header for the file is 13 lines long
  #     including the blank line at the end of the message.
  #
  # Input: a valid mailman list name (with archives)
  #
  PATH2ARC="/var/mailman/archives/private"
  #
  # Check that the list name is valid and the archives exist
  if [ ! -f $PATH2ARC/$1.mbox/$1.mbox ]; then
    echo ERROR: $1 is not a valid mailman list with archives
    echo (be sure to use all lower case)
    echo " "
    exit 0
  fi
  #
  PATH2MB="/home/user/mail"
  #
  # Check that mbox has been created...
  if [ ! -f $PATH2MB/$1 ]; then
    echo ERROR: could not find mailbox $1 in path:
    echo   $PATH2MB  
    echo   Please check that root path to mailbox is correct.
    echo " "
    exit 0
  fi
  #
  # Number of lines in IMAP header
  IHEAD=13
  #
  mv $PATH2ARC/$1.mbox/$1.mbox $PATH2ARC/$1.mbox/$1.mbox.bak
  #
    j=`cat $PATH2MB/$1 |wc -l`
    k=$(( j - IHEAD ))
    tail -$k $PATH2MB/$1 > $PATH2ARC/$1.mbox/$1.mbox
  #
  # now lets remove the old archive files and regen
  # the archives with the new mbox!
  rm -rf $PATH2ARC/$1/*
  /var/mailman/bin/arch $1

===

The scripts aren't tested, but should be good for a quick start!
Take care.  Hope that helps someone.

Jon Carnes

On Tue, 2003-08-12 at 12:09, Jon Carnes wrote:
> I'll give it a shot on one of my boxes (create a soft link to the mbox
> into my mailbox) and let you know... It *should* work.
> 
> On Tue, 2003-08-12 at 11:18, Victor Tsaran wrote:
> > Hi, John!
> > Do you think the access to the mbox can also be done through IMAP? I am not
> > an administrator on this machine, just a list admin, but I need to know what
> > to tell the root.
> > Regards,
> > Victor
> > 
> > 
> > -----Original Message-----
> > From: Jon Carnes [mailto:jonc at nc.rr.com]
> > Sent: Tuesday, August 12, 2003 10:55 AM
> > To: vtsaran at icevi.org
> > Cc: mailman-users at python.org
> > Subject: Re: [Mailman-Users] Managing archives
> > 
> > 
> > On Tue, 2003-08-12 at 09:26, Victor Tsaran wrote:
> > > Hello, listers!
> > > Here is my situation. I am managing several lists for an international
> > > organization. Over the last couple of years our archives have grown quite
> > > large and, I am sure, that many of the messages are no longer necessary to
> > > keep. What is the easiest way for me to pull down the whole archive,
> > convert
> > > it to something that can be reviewed/edited by the organization's
> > secretary,
> > > pull it back together and reupload back to the server. Is there a tool
> > that
> > > will allow me to do this? I myself don't have the time to carry out this
> > > task, however, I cannot expect the secretary to fool around with Unix mail
> > > boxes etc.
> > > Also, I have seen some web sites that zip their messages while archiving.
> > > How is this done?
> > > Thanks much for any response I can get on this.
> > > Regards,
> > > Vic
> > > ------------------------------------------------------
> > 
> > You should be able to set it up so that the secretary can simply browse
> > the archive emails via an email program and then delete the messages he
> > thinks are not necessary.
> > 
> > Mailman archives are stored in an mbox file on the server
> > 
> > If you copy the mbox file to a computer running evolution (that's what I
> > currently use for my email - and its great!) then he can read the
> > messages as though they are simply local messages in the INBOX (or some
> > other folder that you create). Once he deletes the extraneous messages,
> > he does an "expunge" or rebuild on the mailbox! Now you have a new mbox
> > that is ready to be copied back up to the Mailman archives.
> > 
> > Once the mbox is put back in place, you will need to run the
> > ~mailman/bin/arch command to rebuild the archives using the new mbox
> > file.
> > 
> > Aside: I wonder how hard it would be to build a web interface for
> > editing the archives?  We could use formail to break-out each of the old
> > messages and move them into a holding directory, then scan the holding
> > directory to get the subject/date from each message. Display those with
> > a link to pull up the whole message, and a checkbox for deleting the
> > message.
> > 
> > Once you click done, the back-end cgi would reassembles the mbox by just
> > cat-ing the remaining files back together - then it would back up the
> > old mbox file and put this one in place. After that, it would run the
> > Mailman arch program for the list.
> > 
> > OR it would probably be easier to use the existing pipermail setup but
> > add a delete field for use by an admin (running pipermail from a
> > specified ip or from localhost), then use the built-in python libraries
> > for handling mbox - after all, you are just deleting a message from an
> > mbox file and that is a fairly boring/mundane task.
> > 
> > Jon Carnes
> > 
> > 
> 
> 
> ------------------------------------------------------
> Mailman-Users mailing list
> Mailman-Users at python.org
> http://mail.python.org/mailman/listinfo/mailman-users
> Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
> Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
> 
> This message was sent to: jonc at nc.rr.com
> Unsubscribe or change your options at
> http://mail.python.org/mailman/options/mailman-users/jonc%40nc.rr.com





More information about the Mailman-Users mailing list