[prev in list] [next in list] [prev in thread] [next in thread]
List: mhonarc
Subject: RE: Processing months of archives
From: Loong Jackson-ljl004 <ljl004 () email ! mot ! com>
Date: 2000-07-24 19:56:17
[Download RAW message or body]
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@niss.ac.uk]
Sent: Tuesday, February 08, 2000 5:18 AM
To: Email Archive
Cc: mhonarc@ncsa.uiuc.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@niss.ac.uk
e-mail to mobile < 140 chars: andrew.mcgregor@sms.genie.co.uk
[Attachment #3 (text/html)]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2650.12">
<TITLE>RE: Processing months of archives</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2>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.</FONT></P>
<P><FONT SIZE=2>if ( ! -d $outdir ) {</FONT>
<BR><FONT SIZE=2> # oops! it's missing, let's create it</FONT>
<BR><FONT SIZE=2> mkdir $outdir, 0755;</FONT>
<BR><FONT SIZE=2> # we need to update the master index file</FONT>
<BR><FONT SIZE=2> $index = $basedir . \
"index.html";</FONT> <BR><FONT SIZE=2> </FONT>
<BR><FONT SIZE=2> if ( -e $index ) {</FONT>
<BR><FONT SIZE=2> $saved = $index . \
"~";</FONT> <BR><FONT SIZE=2> if \
( rename $index, $saved ) {</FONT> <BR><FONT \
SIZE=2> \
open(OUT,">$index") || die "cannot open target index file: $index \
$!\n";</FONT> <BR><FONT \
SIZE=2> \
open(REF,"$saved" ) || die "cannot open reference index: $saved \
$!\n";</FONT> <BR><FONT \
SIZE=2> \
while(<REF>){</FONT> <BR><FONT \
SIZE=2> # copy line by \
line</FONT> <BR><FONT \
SIZE=2> \
print OUT $_;</FONT> <BR><FONT \
SIZE=2> \
if ( $_ =~ /index starts here/ ) {</FONT> <BR><FONT \
SIZE=2> \
# add in new index for this month</FONT> <BR><FONT \
SIZE=2> \
print OUT "<tr>";</FONT> <BR><FONT \
SIZE=2> \
print OUT "<td>$month</td>";</FONT> <BR><FONT \
SIZE=2> \
print OUT "<td>[<A \
HREF=\"$month/index.html\">date</A>]</td>";</FONT> \
<BR><FONT SIZE=2> \
print OUT "<td>[<A \
HREF=\"$month/threads.html\">thread</A>]</td>";</FONT> \
<BR><FONT SIZE=2> \
print OUT "</tr>\n";</FONT> <BR><FONT \
SIZE=2> \
}</FONT> <BR><FONT SIZE=2> \
}</FONT> <BR><FONT SIZE=2> \
close(OUT);</FONT> <BR><FONT \
SIZE=2> \
close(REF);</FONT> <BR><FONT \
SIZE=2> # change file \
protection for index</FONT> <BR><FONT \
SIZE=2> chmod 0666, \
$index;</FONT> <BR><FONT SIZE=2> }</FONT>
<BR><FONT SIZE=2> }</FONT>
<BR><FONT SIZE=2>}</FONT>
</P>
<P><FONT SIZE=2>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?</FONT></P>
<P><FONT SIZE=2>Regards,</FONT>
<BR><FONT SIZE=2>Jackson</FONT>
</P>
<BR>
<P><FONT SIZE=2>-----Original Message-----</FONT>
<BR><FONT SIZE=2>From: Andrew McGregor [<A \
HREF="mailto:andrew@niss.ac.uk">mailto:andrew@niss.ac.uk</A>]</FONT> <BR><FONT \
SIZE=2>Sent: Tuesday, February 08, 2000 5:18 AM</FONT> <BR><FONT SIZE=2>To: Email \
Archive</FONT> <BR><FONT SIZE=2>Cc: mhonarc@ncsa.uiuc.edu</FONT>
<BR><FONT SIZE=2>Subject: Re: Processing months of archives</FONT>
</P>
<BR>
<P><FONT SIZE=2>to archive on a monthly basis i filter my mails in a .forward</FONT>
<BR><FONT SIZE=2>file and then call a pl script. pls note our email is not \
</FONT> <BR><FONT SIZE=2>sendmail but exim (www.exim.org) so i dont know if sendmail \
</FONT> <BR><FONT SIZE=2>supports the same commands.</FONT>
</P>
<BR>
<P><FONT SIZE=2># .forward</FONT>
<BR><FONT SIZE=2>#Exim filter</FONT>
<BR><FONT SIZE=2>if error_message then finish endif</FONT>
</P>
<P><FONT SIZE=2># Get todays month and year and pipe content off</FONT>
<BR><FONT SIZE=2>if $tod_log matches "^(....-..)"</FONT>
<BR><FONT SIZE=2>then</FONT>
<BR> <FONT SIZE=2>pipe \
"/path-to-scripts/Add2Exploder.pl ${local_part} ${1}"</FONT> <BR><FONT \
SIZE=2>endif</FONT> </P>
<BR>
<BR>
<BR>
<BR>
<BR>
<P><FONT SIZE=2># Add2Archive.pl</FONT>
<BR><FONT SIZE=2>#!/usr/local/bin/perl</FONT>
<BR><FONT SIZE=2># Script to create dated mhonarc forums for Eduserv Exploder</FONT>
<BR><FONT SIZE=2># Usage "cat message | AddArchive.pl <rcfile-prefix> \
<date>"</FONT> <BR><FONT SIZE=2># e.g. "Add2Archive.pl niss \
1999-12"</FONT> </P>
<P><FONT SIZE=2># Designed for use with exim and specifically to allow the \
creation</FONT> <BR><FONT SIZE=2># of directories on the fly.</FONT>
</P>
<BR>
<P><FONT SIZE=2># Static Vars</FONT>
<BR><FONT SIZE=2>my $docdir = '/path-to-htdocs/exploder';</FONT>
<BR><FONT SIZE=2>my $confdir = '/path-to-config/exploder';</FONT>
</P>
<P><FONT SIZE=2># Get Runtime Args</FONT>
<BR><FONT SIZE=2>my $local_part = shift;</FONT>
<BR><FONT SIZE=2>my $month = shift;</FONT>
</P>
<P><FONT SIZE=2># Set output directory and the config file accordingly</FONT>
<BR><FONT SIZE=2>my $outdir = "$docdir/$local_part/$month";</FONT>
<BR><FONT SIZE=2>my $config = "$confdir/$local_part" . \
"-exploder.rc";</FONT> </P>
<P><FONT SIZE=2># Include MhOnarc code</FONT>
<BR><FONT SIZE=2>require 'mhamain.pl';</FONT>
</P>
<P><FONT SIZE=2># Create Date directory if it doesn't exist</FONT>
<BR><FONT SIZE=2>unless ( -d "$outdir" )</FONT>
</P>
<P><FONT SIZE=2> mkdir "$outdir",0755 or die "$0: failed to \
create dir: $outdir: $!\n";</FONT> </P>
<BR>
<P><FONT SIZE=2># Initialise Mhonarc</FONT>
</P>
<P><FONT SIZE=2>mhonarc::initialize();</FONT>
</P>
<P><FONT SIZE=2># Process Message</FONT>
<BR><FONT SIZE=2>mhonarc::process_input(</FONT>
<BR> \
<FONT SIZE=2>'-add',</FONT> \
<BR> \
<FONT SIZE=2>'-quiet',</FONT> \
<BR> \
<FONT SIZE=2>'-nodoc',</FONT> \
<BR> \
<FONT SIZE=2>'-rcfile', \
"$config",</FONT> <BR> \
<FONT SIZE=2>'-outdir', \
"$outdir",</FONT> <BR> \
<FONT SIZE=2>);</FONT> </P>
<BR>
<BR>
<P><FONT SIZE=2>Email Archive wrote:</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> Hiya all,</FONT>
<BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> I am working on getting mhonarc setup. Anyone have any \
pretty</FONT> <BR><FONT SIZE=2>> rc files that i can use as examples? I also have \
the problem</FONT> <BR><FONT SIZE=2>> that I have been archiving email for months \
and months</FONT> <BR><FONT SIZE=2>> in one large file per email list. Does anyone \
know of a way</FONT> <BR><FONT SIZE=2>> to split up this file so mhonarc can \
process it on a month</FONT> <BR><FONT SIZE=2>> by month basis? How can I automate \
this month by month processing</FONT> <BR><FONT SIZE=2>> for the future? I would \
like to archive it as email comes in</FONT> <BR><FONT SIZE=2>> but once a month.. \
generate new web pages and link them to</FONT> <BR><FONT SIZE=2>> a main index \
page so users can just view a specific month</FONT> <BR><FONT SIZE=2>> of a \
mailing list.</FONT> <BR><FONT SIZE=2>> </FONT>
<BR><FONT SIZE=2>> Thanks.. Mike</FONT>
</P>
<P><FONT SIZE=2>-- </FONT>
<BR><FONT SIZE=2>Andrew McGregor, EduServ (NISS), PO BOX 2674, BATH, BA2 7XY.</FONT>
<BR><FONT SIZE=2>T: 01225 826 826 ext. 3419; F: 01225 826 177; E: \
am@niss.ac.uk</FONT> <BR><FONT SIZE=2>e-mail to mobile < 140 chars: \
andrew.mcgregor@sms.genie.co.uk</FONT> </P>
</BODY>
</HTML>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic