[Mailman-Users] Mailman 2.1.5 - FQDN Question

Cogley, Rick rick.cogley at esolia.co.jp
Thu Jul 21 14:22:17 CEST 2005


Hi everyone - 

I was experimenting around with for in do, and there is a much cleaner way
to write this shell script. Try it short at first to get the concept: 

=============
#!/bin/sh
for i in support 911 memo sales
Do
	echo $i
Done 
=============

This scriptlet will just echo four lines: 

support
911
memo
sales

That implied to me that if I can grab the four variable strings I wanted to
prepend the short company name to, I could do all the operations on them,
each loop:  


================8<================
#!/bin/sh
# --
# mm-multi.sh - a script for creating Mailman lists. 
...
echo "mm-multi.sh - <\$Revision: 0.1 $>"

# set global variables
...
MMLISTLANG=en
MMOWNEREMAIL=rick.cogley at domainofmine.co.jp
...
echo
echo Creating lists based on a structure...
while [ "$x" != "y" ]; do
  echo
  echo Enter a short name for the client, no spaces, lowercase:
  read CSN
...
  echo
  echo "Is this correct? (y/n)"
  read x
done

# Loop over strings after in

for i in support 911 memo sales
do 
    echo ===== $CSN-$i =====
    echo
    echo Creating list: $CSN-$i
    $MMBIN/newlist -l $MMLISTLANG -q $CSN-$i $MMOWNEREMAIL $MMADMINPASS 
    
    echo Generating Aliases...
    $MMBIN/genaliases
    
    echo Adding Members... 
    $MMBIN/add_members -r $MMDMEMBERS -w n -a n $CSN-$i
    
    echo Members of $CSN-$i:
    $MMBIN/list_members $CSN-$i
    
    echo Creating file for config_list...
    echo "description = '$CSN-$i'" >/tmp/mm-$CSN-$i
    echo "host_name = 'esolia.net'" >>/tmp/mm-$CSN-$i
    echo "max_message_size = 0" >>/tmp/mm-$CSN-$i
    echo "available_languages = ['en', 'ja']" >>/tmp/mm-$CSN-$i
    echo Configuring list...
    $MMBIN/config_list -i /tmp/mm-$CSN-$i $CSN-$i
    
    $MMBIN/withlist -l -r fix_url $CSN-$i -u www.domainofmine.net -v 
    echo
done 

# cleanup
rm -f /tmp/mm-*

exit 0
==============8<================

Hope this helps someone. 

Cheers,
Rick Cogley
Tokyo, Japan



More information about the Mailman-Users mailing list