I used a similar approach but take one step further which also update the
top level index.html file to insert 2 URL for the respective index files.
if ( ! -d $outdir ) {
# oops! it's missing, let's create it
mkdir $outdir, 0755;
# we need to update the master index file
$index = $basedir . "index.html";
if ( -e $index ) {
$saved = $index . "~";
if ( rename $index, $saved ) {
open(OUT,">$index") || die "cannot open target index file: $index
$!\n";
open(REF,"$saved" ) || die "cannot open reference index: $saved
$!\n";
while(<REF>){
# copy line by line
print OUT $_;
if ( $_ =~ /index starts here/ ) {
# add in new index for this month
print OUT "<tr>";
print OUT "<td>$month</td>";
print OUT "<td>[<A
HREF=\"$month/index.html\">date</A>]</td>";
print OUT "<td>[<A
HREF=\"$month/threads.html\">thread</A>]</td>";
print OUT "</tr>\n";
}
}
close(OUT);
close(REF);
# change file protection for index
chmod 0666, $index;
}
}
}
However, I'm struggling in file protection rights. Since my pipe is done
within the mail aliases file, the script inherited ownership of
"daemon:other". The default umask of "daemon:other" is rw-r-----. This
means the web server cannot read the output files. Is there an easy way to
change this?
Regards,
Jackson
-----Original Message-----
From: Andrew McGregor [mailto:andrew(_at_)niss(_dot_)ac(_dot_)uk]
Sent: Tuesday, February 08, 2000 5:18 AM
To: Email Archive
Cc: mhonarc(_at_)ncsa(_dot_)uiuc(_dot_)edu
Subject: Re: Processing months of archives
to archive on a monthly basis i filter my mails in a .forward
file and then call a pl script. pls note our email is not
sendmail but exim (www.exim.org) so i dont know if sendmail
supports the same commands.
# .forward
#Exim filter
if error_message then finish endif
# Get todays month and year and pipe content off
if $tod_log matches "^(....-..)"
then
pipe "/path-to-scripts/Add2Exploder.pl ${local_part} ${1}"
endif
# Add2Archive.pl
#!/usr/local/bin/perl
# Script to create dated mhonarc forums for Eduserv Exploder
# Usage "cat message | AddArchive.pl <rcfile-prefix> <date>"
# e.g. "Add2Archive.pl niss 1999-12"
# Designed for use with exim and specifically to allow the creation
# of directories on the fly.
# Static Vars
my $docdir = '/path-to-htdocs/exploder';
my $confdir = '/path-to-config/exploder';
# Get Runtime Args
my $local_part = shift;
my $month = shift;
# Set output directory and the config file accordingly
my $outdir = "$docdir/$local_part/$month";
my $config = "$confdir/$local_part" . "-exploder.rc";
# Include MhOnarc code
require 'mhamain.pl';
# Create Date directory if it doesn't exist
unless ( -d "$outdir" )
mkdir "$outdir",0755 or die "$0: failed to create dir: $outdir: $!\n";
# Initialise Mhonarc
mhonarc::initialize();
# Process Message
mhonarc::process_input(
'-add',
'-quiet',
'-nodoc',
'-rcfile', "$config",
'-outdir', "$outdir",
);
Email Archive wrote:
Hiya all,
I am working on getting mhonarc setup. Anyone have any pretty
rc files that i can use as examples? I also have the problem
that I have been archiving email for months and months
in one large file per email list. Does anyone know of a way
to split up this file so mhonarc can process it on a month
by month basis? How can I automate this month by month processing
for the future? I would like to archive it as email comes in
but once a month.. generate new web pages and link them to
a main index page so users can just view a specific month
of a mailing list.
Thanks.. Mike
--
Andrew McGregor, EduServ (NISS), PO BOX 2674, BATH, BA2 7XY.
T: 01225 826 826 ext. 3419; F: 01225 826 177; E: am(_at_)niss(_dot_)ac(_dot_)uk
e-mail to mobile < 140 chars:
andrew(_dot_)mcgregor(_at_)sms(_dot_)genie(_dot_)co(_dot_)uk