Great Circle Associates Majordomo-Users
(July 1996)
 

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

Subject: How to set up Digest/Archive
From: Dale Cook <cdm @ hyperk . com>
Date: Tue, 2 Jul 1996 08:44:35 -0600
To: Majordomo-Users @ GreatCircle . COM

Greetings:

Due to the unusually high number of folks having trouble with digests & archives, I thought I'd repost a note from back in January, when Tom Limoncelli (tal@plts.org  http://mars.superlink.net/user/tal) kindly offered up a perl program to create the directories and aliases required to set up a list, including digests and archives, from scratch.  I'm here to tell you that it works like a charm, and if you are struggling with digests and archive, you might consider trying it out.  There are a couple of changes necessary to the code to make it create the directories where you want them, but I think it's pretty straightforward to change.  I am reposting his entire message, which includes a shell archive at the end which when run will re-create the perl program.  One gotcha: it will create the directories automatically, but spits the aliases out via stdout, so you need to redirect stdout to a file to capture them for inclusion in the aliases file.

Tom, if you're still out there, thanks a bundle.  I've used it twice now and it works great!

-----dale
================================> Original note follows:
Someone asked:  
> The majordomo message is *still* processed it looks like (I got a message 
> back from Majordomo@wwti.iway.net about my 'help' request), but (1) while 
> it is processing the mail message it takes about 10 seconds (maybe a 
> little shorter) and (2) causes the above memory fault and writes me a 
> message. I also checked all permissions on files.... Has anyone else out 
> there had this problem?

To which Tom replies:

(WILL SOMEONE VERIFY THIS THEORY AND ADD IT TO THE FAQ?)

memory fault?  Sounds like a problem I had and just fixed.

--- START OF PROPOSED FAQ ENTRY ---

Problem:
	I get memory fault reports, especially from /bin/sh
	Majordomo takes forever to process requests.

The answer is:
	Your directory permissions aren't permitting shlock.pl to lock
things correctly.  In particular, the log file can't be locked.

Long story:
When installing majordomo, chances are things aren't going to be
set up right on the first try.  So, majordomo runs, finds an error,
and tries to log it.
	The logging process locks the log, which it can't do since
	the permissions are set wrong.  So, it logs this error.
		The logging process locks the log, which it can't do since
		the permissions are set wrong.  So, it logs this error.
			The logging process locks the log...
			etc. etc.
After about 10 zillion iterations of this, perl dies because it runs out
of stack space.  The shell (for some reason the error is usually reported
as coming from /bin/sh) reports a memory fault.

The documentation isn't clear about permissions and ownership of the
files.  It would be great if it listed everything in one place.

--- END OF PROPOSED FAQ ENTRY ---

You can add the following to the Majordomo distribution if you want:

After a day of hacking, I got frustrated enough to write the following
script called "mklist".  The command "mklist listname" creates all
the files/directories needed for the mailing list, checks the permissions
on all files and directories (I don't think I missed anything), then
outputs the correct entries for /etc/aliases.

If you run it and the files/directories already exist, it checks
them for proper ownership/group/mode attributes.  It doesn't fix
things, but it outputs the right commands for you to execute.

I haven't written a README for it yet but the source is pretty readable.

--tal
-- 
     Tom Limoncelli -- tal@plts.org -- http://mars.superlink.net/user/tal
<*>      "PGP-Signed email serves no purpose other than to stroke the
       sender's ego.  Do you flash your license and passport to identify
         yourself when you approach friends for casual conversation?"


#!/bin/sh
# This is a shell archive (shar 3.21)
# made 01/11/1996 20:46 UTC by tal@plts.org
# Source directory /home/tal/bin
#
# existing files WILL be overwritten
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#   4684 -rwxrwxr-x mklist
#
if touch 2>&1 | fgrep '[-amc]' > /dev/null
 then TOUCH=touch
 else TOUCH=true
fi
# ============= mklist ==============
echo "x - extracting mklist (Text)"
sed 's/^X//' << 'SHAR_EOF' > mklist &&
X#!/usr/local/bin/perl
X
X$LISTNAME = shift @ARGV;
X$LISTOWNER = "tal";	# who owns the lists
X#$WRAPPERBASE = "/var/spool/majordomo/wrapper ";  # standard majordomo wrapper
X$WRAPPERBASE = "/var/spool/majordomo/run";	# my modified wrapper
X
X$majordomo_uid = getpwnam( 'majordom' );	# uid of files/dirs
X$majordomo_gid = getgrnam( 'majordom' );	# gid of files/dirs
X$perm_diro  = "0775";	# mode for directories (open)
X$perm_dirf  = "0770";	# mode for directories (facist)
X$perm_fileo = "0664";	# mode for files (open)
X$perm_filef = "0660";	# mode for files (facist)
X
X#
X# NOTE: Below I use /etc/majordomo.cf.new, most likely
X#
X$cf = "/etc/majordomo.cf.new"; # if this isn't my site
X#$cf = "/etc/majordomo.cf"; # if this is my site
Xeval(`cat $cf`) || die "eval of $cf failed $@";
X
X#
X# Check our input
X#
Xdie "Usage: mklist LISTNAME\n" unless length( $LISTNAME );
X
X#
X# Now do all the work
X#
X
X# Check the base directories
X&mkdir( $perm_diro,  "$homedir" );
X&mkdir( $perm_diro,  "$filedir" );
X&mkdir( $perm_diro,  "$listdir" );
X&mkdir( $perm_dirf,  "$digest_work_dir" );
X&touch( $perm_fileo, "$log" );
X
X# Check the directories needed for this list
X&mkdir( $perm_diro, "$filedir/$LISTNAME$filedir_suffix" );
X
X# Check the files needs for this list
X&touch( $perm_fileo, "$listdir/${LISTNAME}" );
X&touch( $perm_fileo, "$listdir/${LISTNAME}-digest" );
X&store( $perm_filef, "$listdir/${LISTNAME}.passwd", "PASSWORD" );
X&store( $perm_filef, "$listdir/${LISTNAME}-digest.passwd", "PASSWORD" );
X&store( $perm_fileo, "$listdir/${LISTNAME}.info", "Paragraph or so of info\n" );
X&store( $perm_fileo, "$listdir/${LISTNAME}-digest.info", "Lots of paras\n" );
X&mkdir( $perm_dirf,  "$digest_work_dir/${LISTNAME}-digest" );
X
X# Output the aliases required for this list
Xprint <<HERE
X
X#
X#   \u$LISTNAME mailing list
X#          This is a majordomo mailing list plus a -digest version.
X#          The list is archived.
X#
X$LISTNAME: "|${WRAPPERBASE}resend -l $LISTNAME -h plts.org $LISTNAME-outgoing"
Xowner-$LISTNAME: $LISTOWNER
X$LISTNAME-outgoing: :include:$listdir/$LISTNAME,
X  "|${WRAPPERBASE}digest -r -C -l $LISTNAME-digest $LISTNAME-digest-outgoing",
X  "|${WRAPPERBASE}archive2.pl -a -m -f $filedir/$LISTNAME$filedir_suffix"
Xowner-$LISTNAME-outgoing: owner-$LISTNAME
X$LISTNAME-approval: $LISTOWNER
X#$LISTNAME-request: "|${WRAPPERBASE}request-answer $LISTNAME"
X$LISTNAME-request: "|${WRAPPERBASE}majordomo -l $LISTNAME"
X$LISTNAME-digest: $LISTNAME
Xowner-$LISTNAME-digest: owner-$LISTNAME
X$LISTNAME-digest-outgoing: :include:$listdir/${LISTNAME}-digest
Xowner-$LISTNAME-digest-outgoing: owner-$LISTNAME
X$LISTNAME-digest-approval: $LISTNAME-approval
X#$LISTNAME-digest-request: "|${WRAPPERBASE}request-answer $LISTNAME-digest"
X$LISTNAME-digest-request: "|${WRAPPERBASE}majordomo -l $LISTNAME-digest"
X
XHERE
X;
X
X
Xsub mkdir {
X	($perm, $fname) = @_;
X#print "DEBUG: checkdir $fname\n";
X	if (-d $fname ) {
X		local($dev,$ino,$mode,$nlink,$uid,
X			$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks)
X			= stat($fname);
X		$mode = $mode & 0777;
X		print "chown $majordomo_uid $fname\n" if $uid != $majordomo_uid;
X		print "chgrp $majordomo_gid $fname\n" if $gid != $majordomo_gid;
X#print "DEBUG: modeof $fname is $mode (want ", oct($perm), ")\n";
X		print "chmod $perm $fname\n" if $mode != oct($perm);
X	} else {
X		mkdir( $fname, $perm );
X		chown $majordomo_uid, $majordomo_gid, $fname;
X		chmod oct($perm), $fname;
X	}
X}
X
Xsub touch {
X	($perm, $fname) = @_;
X#print "DEBUG: touch $fname\n";
X	if (-f $fname ) {
X		local($dev,$ino,$mode,$nlink,$uid,
X			$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks)
X			= stat($fname);
X		$mode = $mode & 0777;
X		print "chown $majordomo_uid $fname\n" if $uid != $majordomo_uid;
X		print "chgrp $majordomo_gid $fname\n" if $gid != $majordomo_gid;
X#print "DEBUG: modeof $fname is $mode (want ", oct($perm), ")\n";
X		print "chmod $perm $fname\n" if $mode != oct($perm);
X	} else {
X		open(FI, ">>$fname") || die "Can't create $fname: $!"; close FI;
X		chown $majordomo_uid, $majordomo_gid, $fname;
X		chmod oct($perm), $fname;
X	}
X}
X
Xsub store {
X	($perm, $fname, $text) = @_;
X#print "DEBUG: create $fname\n";
X	if (-f $fname ) {
X		local($dev,$ino,$mode,$nlink,$uid,
X			$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks)
X			= stat($fname);
X		$mode = $mode & 0777;
X		print "chown $majordomo_uid $fname\n" if $uid != $majordomo_uid;
X		print "chgrp $majordomo_gid $fname\n" if $gid != $majordomo_gid;
X#print "DEBUG: modeof $fname is $mode (want ", oct($perm), ")\n";
X		print "chmod $perm $fname\n" if $mode != oct($perm);
X	} else {
X		open(FI, ">>$fname") || print die "Can't create $fname: $!";
X		print FI $text; close FI;
X		chown $majordomo_uid, $majordomo_gid, $fname;
X		chmod oct($perm), $fname;
X	}
X}
X
SHAR_EOF
$TOUCH -am 0108224196 mklist &&
chmod 0775 mklist ||
echo "restore of mklist failed"
set `wc -c mklist`;Wc_c=$1
if test "$Wc_c" != "4684"; then
	echo original size 4684, current size $Wc_c
fi
exit 0


==========================================================================
Dale Cook                                         Telephone (208) 525-3708
Scientech, Inc                                    Email     cdm@Hyperk.com
1690 International Way                            Fax       (208) 529-4721
Idaho Falls, Id 83402				  


Follow-Ups:
Indexed By Date Previous: Re: Reply-To
From: Richard Pieri <ratinox@unilab.dfci.harvard.edu>
Next: Re: Unable to get approve a message from a remote PC
From: Javier Santiago Arenas <javiers@tule.antequera.com>
Indexed By Thread Previous: Re: -SUBJECTS- token being removed???
From: Shawn Steele <shawn@aob.org>
Next: Approve and/or Pine
From: Ken Rice <krice@support.bibfile.com>

Google
 
Search Internet Search www.greatcircle.com