Great Circle Associates Majordomo-Workers
(October 1998)
 

Indexed By Date: [Previous] [Next] Indexed By Thread: [Previous] [Next]

Subject: building the aliases file on the fly.
From: "Randall S. Winchester" <rsw @ Glue . umd . edu>
Date: Wed, 7 Oct 1998 03:21:51 -0400 (EDT)
To: Jason L Tibbitts III <tibbs @ hpc . uh . edu>
Cc: majordomo-workers @ GreatCircle . COM
In-reply-to: <ufabtnpx8pt.fsf@sina.hpc.uh.edu>


Currently when you create a list you get a nice little message printed out
from lib/Mj/MTAConfig.pm/ "sub sendmail{}", telling you what to put in your
aliases file.

The change (hack) we added to generate the aliases file was in
lib/auto/Majordomo/_createlist.al "sub _createlist{}".

You basically do the same thing as you do in sub_sendmail{} except you write
to a file. (which we hardcoded in out hack).

I do not see that it would be a problem to just generate this alias file.
Even if it is only used for historical archival purposes. Otherwise you
could say if some flag is null to not write the file out I guess.

What we did was create a seperate alias file for "majordomo", and then one
for each "virtual host" ($aliasfile = "$aliasdir/$dom";). We created a
directory in /var/spool/majordomo/aliases (with permissions to make sendmail
and mj2 happy). When we installed mj2, the first output from sub_sendmail{}
we cut and pasted to /var/spool/majordomo/aliases/majordomo, but this should
be automated also ($aliasfile = "$aliasdir/majordomo). Anyhow, these are our
current aliases files:

 majordomo
 majordomo.db
 coursemail.umd.edu
 coursemail.umd.edu.db
 majordomo2.umd.edu
 majordomo2.umd.edu.db

/etc/sendmail.cf contains things like this:
O AliasFile=/var/spool/majordomo/aliases/majordomo,\
	/var/spool/majordomo/aliases/majordomo2.umd.edu,\
	/var/spool/majordomo/aliases/coursemail.umd.edu,\
	/local/mail/aliases/aliases.system

# automatically rebuild the alias database?
O AutoRebuildAliases=True


Our simple hack to _creatlist.al was just:

  $aliasdir = "/var/spool/majordomo/aliases";
  $aliasfile = "$aliasdir/$dom";
  warn "can\'t checkout $aliasfile .. bye bye..\n" if (system("$bdir/co", "-l", "-q", $aliasfile));
  open(ALIAS, ">>$aliasfile") || die "Can't open $aliasfile: $!";
  printf ALIAS "### Aliases for %s at %s\n", $list, $dom;
  printf ALIAS "%s:\t\"|%s/mj_resend -d %s -l %s\n", $list, $bdir, $dom, $list;
  printf ALIAS "%s-request:\t\"|%s/mj_email -d %s -l %s\n", $list, $bdir, $dom, $list;
  printf ALIAS "%s-owner:\t%s,\n", $list, $owner;
  printf ALIAS "owner-%s:\t%s,\n", $list, $owner;
  printf ALIAS "### End of aliases for %s at %s\n", $list, $dom;
  close(ALIAS);
  warn "Can't Check in $aliasfile ...\n" if (system("$bdir/ci", "-q","-m$list", "-u", $aliasfile));

  return (1, $head, $rmess);


It should just be doing the "Mj::File" locking and not bother with the RCS
stuff, but we were being cautions when we added this.


Anyways, this is all we needed to add to get mj2 to instantly create lists
on the fly. We have had several hundred list created this way, some with
hundreds of users.

Randall



Follow-Ups:
References:
Indexed By Date Previous: Re: A backwords sort of configuration
From: "Randall S. Winchester" <rsw@Glue.umd.edu>
Next: Trigger my trusty horse...
From: "Randall S. Winchester" <rsw@Glue.umd.edu>
Indexed By Thread Previous: Re: A backwords sort of configuration
From: Jason L Tibbitts III <tibbs@hpc.uh.edu>
Next: Re: building the aliases file on the fly.
From: Jason L Tibbitts III <tibbs@hpc.uh.edu>

Google
 
Search Internet Search www.greatcircle.com