[Mailman-Users] Re: Adding a List

JOHN BLEASDALE jbleasdale at rm.com
Tue Oct 3 18:40:10 CEST 2000


> Has anyone written a script to automate the process of adding a list
> append to /etc/aliases then "newaliases" as root)?

Here's a script I posted in June when the question was last asked. We use
this setup running MailMan 2.0b2, Sendmail 8.9.3 and RedHat 6.2.

I use a wrapper script for newlist that does the creation and aliases file
work non-interactively. You can then call this wrapper from a CGI script or
any automated process that you like.

To do this, alter the newlist script so that the alias template just returns
the exact lines you would like to be entered into your aliases file (I just
take the 4 aliases, with no comments or date) and remove the request to hit

< Entry for aliases file:
< ## %(listname)s mailing list
< ## created: %(date)s %(user)s
< %(list)s "|%(wrapper)s post %(listname)s"
> ALIASTEMPLATE = '''%(list)s "|%(wrapper)s post %(listname)s"
<             'date'    : time.strftime('%d-%b-%Y',
<             'user'    : getusername(),
<         if len(argv) < 5:
<             print ("Hit enter to continue with %s owner notification..."
<                    % listname),
<             sys.stdin.readline()

I then use this shell script to add lists:

# Wrapper for Mailman's default newlist python script.
# Pipes output from modified version of newlist straight into aliases file.
# Any mistakes will end up in aliases file so be careful!

if [ "$3" = "" ]
    echo -e "\n\tUsage: $0 listname admin-email-address password\n"
    exit 1

# Does the list exist?
result=`/usr/local/mailman/bin/list_lists $1 | grep -iw $1 | wc -w`

# If not, add it
if [ $result -eq 0 ]
    /usr/local/mailman/bin/newlist $1 $2 $3 >> /etc/aliases

This requires that the /etc/aliases file be owned by mailman, so you may
want to review any security implications.


STANDARD DISCLAIMER: This message is confidential. You should not copy it or
disclose its contents to anyone. You may use and apply the information only
for the intended purpose. Internet communications are not secure and
therefore RM does not accept legal responsibility for the contents of this
message. Any views or opinions presented are only those of the author and
not those of RM. If this email has come to you in error please delete it and
any attachments.

More information about the Mailman-Users mailing list