[Mailman-Users] Re: automated list creation (non-interactive)

JOHN BLEASDALE jbleasdale at rm.com
Wed Jun 28 09:41:31 CEST 2000


Chris,

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 proccess 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
enter:


48,53c48
< ALIASTEMPLATE = '''
< 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"
56,57c51
< %(owner2)s %(listname)s-admin
< '''
---
> %(owner2)s %(listname)s-admin'''
126,127d119
<             'date'    : time.strftime('%d-%b-%Y',
time.localtime(time.time())),
<             'user'    : getusername(),
130,133d121
<         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:


#!/bin/bash

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

# 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 ]
then
    /usr/local/mailman/bin/newlist $1 $2 $3 >> /etc/aliases
    newaliases
fi


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

Cheers,
John


<<<<
Date: Tue, 27 Jun 2000 16:07:27 -0400
From: "Christopher T. Lansdown" <lansdoct at screech.cs.alfred.edu>
To: mailman-users at python.org
Subject: [Mailman-Users] automated list creation (non-interactive)

Hi,
	The newlist script is quite easy to use, but the problem with it is
that it requires a user at the console.  I'm working on a system which sets
up a mailman account as part of a bunch of stuff set up, and consequently
want to automate the list creation process.
	I really don't want to have to fake a controlling terminal, so if
anyone has a suggestion I would really appreciate it.  Thanks in advance.
	-Chris
P.S. please cc me on all replies. 
>>>>



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