Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] Mail archiving question
- Date: Sat, 4 Aug 2007 18:22:14 +0900
- From: "Josh Glover" <jmglov@example.com>
- Subject: Re: [tlug] Mail archiving question
- References: <5634e9210708030501q228e9e31ya2f3dfdb29168cf6@mail.gmail.com> <87odhobsfy.fsf@uwakimon.sk.tsukuba.ac.jp> <5634e9210708031804i4be7316fu1215cf25903bc99d@mail.gmail.com>
On 04/08/07, Jim Breen <jimbreen@example.com> wrote: > On 04/08/07, Stephen J. Turnbull <stephen@example.com> wrote: > > > MHonArc may have an appropriate option. > > Thanks. I'll look into that. We actually have the archive system > already, with regex searching, etc. It's the one-off importing of > a batch of emails that's needed. It does. Here is how I used it plus formail to do a similar thing: # Become the mailing list user sudo su - list # Don't mess with this stuff unless you really know what you are doing ARCHIVE_ROOT='./archive' MBOX_ROOT='/var/spool/mail/list' # Change this to the list you want to rebuild LIST_NAME='testing' # Back up the current archives for i in \ `find "${ARCHIVE_ROOT}${LIST_NAME}/" -type d | grep -v .svn | sed -e 1d`; do mv "${i}" "${i}.BAK" done # Rebuild from Mailman's private archives cat "${MBOX_ROOT}${LIST_NAME}.mbox/${LIST_NAME}.mbox" \ | formail -s \ perl -e 'while (<>) { # For the first line, parse the From chunk exit 1 unless $. > 1 or /^From\s \S+\s # email address (Mon|Tue|Wed|Thu|Fri|Sat|Sun)\s (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s \d{2}\s # month \d{2}:\d{2}:\d{2}\s # time \d{2}(\d{2})$ # year /x; my $mon = { Jan => "01", Feb => "02", Mar => "03", Apr => "04", May => "05", Jun => "06", Jul => "07", Aug => "08", Sep => "09", Oct => "10", Nov => "11", Dec => "12", }->{$2} or exit 2; my $year = $3 or exit 3; # If this is line 1, open the pipe if ($. == 1) { open ARCHIVER, "| "/usr/bin/mhonarc -quiet -spammode -outdir ${LIST_NAME}/$year$mon -rcfile ${LIST_NAME}/main.rc -umask 002 -add" or die "Cannot run mhonarc: $!"; warn $_; } print ARCHIVER $_; } close ARCHIVER; ' Is that close enough to what you need to do to be of any use? -- Cheers, Josh
- References:
- [tlug] Mail archiving question
- From: Jim Breen
- [tlug] Mail archiving question
- From: Stephen J. Turnbull
- Re: [tlug] Mail archiving question
- From: Jim Breen
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] Expensive Microsoft
- Next by Date: Re: [tlug] What would happen to the Internet if the US fell off the map
- Previous by thread: Re: [tlug] Mail archiving question
- Next by thread: [tlug] Apple owns CUPS
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links