[Mailman-Users] Managing archives

Jon Carnes jonc at nc.rr.com
Wed Aug 13 14:57:18 CEST 2003


oops... forgot to set the rights for the new archive mbox file...
I added that to the second script.

Jon Carnes

A script 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
    chown mailman.mailman $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






More information about the Mailman-Users mailing list