>>>>> "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:
|
|