mhonarc-users

Re: Ezmlm and MHonArc permissions problem

1999-02-18 14:37:31
On February 18, 1999 at 10:37, "Rick McMillin" wrote:

The problem I'm having is when I test this out by creating
the "1999-02" directory and posting my first message to the
list, it will automatically create all of files fine, but the permissions
are wrong on all of the files.  Instead of being set to 644, they
end up being set to 600. 

This has to do with the current umask setting of the process.  You
can use the UMASK resource in MHonArc to explicit set have mhonarc
set its umask before processing.


Also, does anyone have any ideas as to how I can set this up
to automatically create my "YYYY-MM" directories when the first
message for the month gets posted to the list so I don't have to
go in and create all of them by hand?

There is more than one way to do it.  Probably the most efficient
method is to create your own derivative of mhonarc to precreate
the directory beforehand.  You can use the mhonarc program source
as a base.  Example program:

--CUT-HERE--
#!/usr/local/bin/perl
## Description:
##      Custom version of MHonArc to create monthly-based archives.
##      It is assumed that this program will be called from an MTA
##      (or similiar program) as message arrive.

## Change the following pathname to location of MHonArc libraries on your
## system.
use lib qw( /path/to/MHonArc/lib );

MAIN: {
    ## Set umask here since we will be doing some of our own stuff.
    umask 022;

    ## Load main MHonArc library
    require 'mhamain.pl' || die qq/ERROR: Unable to require "mhamain.pl"\n/;
    mhonarc::initialize();

    ## Figure out archive location.  Note, there can be a slight descrepency
    ## on the archive month and the actual month of the added message.  To
    ## be more accurate, the message date should be extracted, but this
    ## would require more work.
    my($month, $year) = (gmtime(time))[4,5]; # use localtime() if desired
    ++month;  $year+=1900;
    my $dir = sprintf("/www/outdir/%4d-%02d", $year, $month);
    mkdir $dir, 0777;   # Ignore return since directory may already exist.

    ## Call MHonArc functions to add message.  We just specify all the
    ## options we want here since this is a custom version and not intended
    ## to be called interactively.
    mhonarc::process_input(
        '-add',
        '-quiet',
        '-outdir, $dir'
    ) ? exit(0) : exit($mhonarc::CODE);
}
--CUT-HERE--

Assume we call this program "ezmlm-mhonarc".  Then change the line in your
ezmlm editor file that invokes mhonarc to the following:

|ezmlm-mhonarc


Note, the above program has not been tested, so test it first if plan
to use it.

        --ewh

----
             Earl Hood              | University of California: Irvine
      ehood(_at_)medusa(_dot_)acs(_dot_)uci(_dot_)edu      |      Electronic 
Loiterer
http://www.oac.uci.edu/indiv/ehood/ | Dabbler of SGML/WWW/Perl/MIME

<Prev in Thread] Current Thread [Next in Thread>