Re: Archiving a mailing list

From: Charles Hall <chall_at_totalsports.net_at_hypermail-project.org>
Date: Mon, 14 Sep 1998 11:19:26 -0400
Message-ID: <35FD33FE.3BBB_at_totalsports.net>


Shane Wegner wrote:
>
> Sorry if this was asked before but it's not in the FAQ. I have noticed
> many mailing lists archived with hypermail which have different sections
> depending on the month. How is this done. At the moment, I have procmail
> filtering messages into ~/.marchive/listname and have listname.config. My
> script to do the nightly archiving looks something like:

They discussed something similar to this on the list a week or so ago. For users who are on the same server as the mail host, apparently you can snag the monthly archive direct from the server. I guess MajorDomo and Listproc have some sort of monthly archive option.

If you're not on the mail server, you could either send an email request for the monthly archive on a regular basis, or break it out by month as it arrives every day. That's what I have to do.

I run this script every night. It uses the the non-existence of a monthly directory to trigger it's creation and the erasure of the mail file (containing last month's mail). It also reindexes the entire archive.


#!/usr/local/bin/perl
#
#                 HYPERCRON - Hypermail Cron Job
#                           May 1998
#                        by Charles Hall
#
# Update the appropriate directory (i.e. "1998/May") with the mailbox
contents
# and handle end-of-month processing. Let mailbox grow until the 1st day of the
# new month, then process it into last month and delete it; make a new sub-dir
# for the new month.
#
  $home = "/httpd/htdocs/baidarka"; # Mailing list archive is "baidarka"
  $mbox = "/var/spool/mail/baidarka"; # Local mail recipient is also "baidarka"

  _at_mon = (Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec); # Today's date.
  _at_now = localtime(time);
  $month = $mon[$now[4]];
  $year = $now[5] + 1900;

# At start of a new month, create new directory and # send last messages to previous month.

  if (! -e "$home/$year/$month") {

     `mkdir -p "$home/$year/$month"`;
     if ($month eq "Jan") {
        $month = "Dec";
        $year--;
     } else {
        $month = $mon[$now[4]-1];
     }
     $flag = 1;

  }    

  _at_lp = `/usr/local/bin/hypermail -m $mbox -d $home/$year/$month -a "/baidarka" 2>&1`;
  print "hypermail -m $mbox -d $home/$year/$month -a /baidarka\n";   print _at_lp;   

#  _at_lp = `/usr/local/bin/swish -c /usr/local/Swish/baidarka.conf 2>&1`;
#  print "swish -c /usr/local/Swish/baidarka.conf\n";
#  print _at_lp;

   _at_lp = `/httpd/htdocs/baidarka/wgreindex -q 2>&1`;    print "/httpd/htdocs/wgreindex -q\n";    print _at_lp;

# Blank out last months accumulated mail.   if ($flag) {
# Can't unlink because of /var/spool/mail permissions, just open and close.

     open(X,">$mbox") || die "Couldn't open $mbox: $!\n";
     close(X);

  }
-- 
Charles Hall
Total Sports
Raleigh, NC USA
http://info.totalsports.net
Received on Mon 14 Sep 1998 05:24:52 PM GMT

This archive was generated by hypermail 2.3.0 : Sat 13 Mar 2010 03:46:11 AM GMT GMT