Great Circle Associates Majordomo-Users
(May 1998)
 

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

Subject: Re: Adding users to a list auto?
From: Jason L Tibbitts III <tibbs @ hpc . uh . edu>
Date: 01 May 1998 16:04:24 -0500
To: Tim Connolly <tec @ mountain . net>
Cc: "majordomo-users @ GreatCircle . COM" <majordomo-users @ GreatCircle . COM>
In-reply-to: Tim Connolly's message of "Fri, 01 May 1998 16:30:25 -0400"
References: <354A30E1.96D6FA1@mountain.net>

>>>>> "TC" == Tim Connolly <tec@mountain.net> writes:

TC> Has anyone been able to use "adduser" to create an account and add the
TC> email address to a mailing list ?

Wrap it in a trivial shell script?

#!/bin/sh
/path/to/adduser.real $@
echo "approve blah zubscribe list $1@your.host" | mail majordomo

(untested and probably slightly broken, but you should get the idea).

Or run the mailall program which I post occasionally.  Here's a copy; hack
as necessary.

 - J<

#!/usr/local/bin/perl5 -w
#
# mailall
#
# sends mail to all users on this host.  verifies that the user is really
# a user by checking uid, shell, and login name.  allows us to send mail
# to, for example, "allusers@mother.cs.colorado.edu" and delievers that
# mail to all the "real" people on that machine.
#
# requires a line in /usr/lib/aliases like:
# allusers: "|/usr/local/bin/mailall"
#
# Originally By: davewood@cs.colorado.edu
#     October 15, 1992
# Hacked, mangled, and rewritten by
#     Jason L. Tibbitts <tibbs@hpc.uh.edu>


# Set this for testing
$DEBUG = 0;

# Ignore all users with IDs less than this
$MIN_ID = 1000;

# Where to find list of shells
$ETC_SHELLS = "/etc/shells";

# Where to find the list of accounts
$ETC_PASSWD = "/etc/passwd";

# These users will not be sent mail
@nomail = qw(
	     nobody
	     noacess
	     tester
	    );

# Grab the list of valid shells; users without a valid shell will get no
# mail
open(SHELLS,$ETC_SHELLS) ||
  die("Can't open list of valid shells: $ETC_SHELLS, $!, stopped");
@shells = <SHELLS>;
close SHELLS;

# Go through the password file and find real users
open(PASSWD,$ETC_PASSWD) || die ("Can't open password file: $ETC_PASSWD: $!, stopped");
foreach (<PASSWD>) {
  ($login,$dummy,$uid,$dummy,$dummy,$dummy,$shell) = split(/:/);
  push(@mailto,$login) if ($uid >= $MIN_ID &&
			   grep(/^$shell$/,@shells) && 
			   $shell !~ /^$/) &&
			     !grep(/^$login$/,@nomail);
}
close PASSWD;

if ($DEBUG) {
  print "Will send mail to these users:\n";
  foreach (@mailto) {
    print "$_\n";
  }
  exit 0;
}

# Dump standard input into a message sent to all valid users
open (MAIL,"|/usr/lib/sendmail @mailto");
foreach (<STDIN>) {
  print MAIL;
}
close MAIL;


References:
Indexed By Date Previous: Re: Adding users to a list auto?
From: Bryan Fullerton <bryanf@samurai.com>
Next: Re: Pricing question/survey
From: Jeff Halper <jeff@ihot.com>
Indexed By Thread Previous: Re: Adding users to a list auto?
From: Tim Connolly <tec@mountain.net>
Next: majordomo 1.93 and sendmail 8.9
From: Kitty Smith <smith@twsuvm.uc.twsu.edu>

Google
 
Search Internet Search www.greatcircle.com