listnew: Check arguments, handle new list_url argument, name parameters, add usage
[clinton/scripts.git] / listnew
... / ...
CommitLineData
1#!/bin/bash -e
2#
3# Make a new mailing list. Run as root on deleuze.
4#
5# Usage: listnew LISTNAME LISTDOMAIN LISTURL USER INITIAL_PASSWORD
6
7BIN=/var/lib/mailman/bin
8
9function usage() {
10 echo "Usage: listnew list_name domain list_url user initial_password"
11}
12
13if test -n "$6"; then
14 echo "Too many arguments"
15 usage
16 exit 1
17elif test -z "$5"; then
18 echo "Not enough arguments"
19 usage
20 exit 1
21else
22 LIST_NAME=$1
23 LIST_DOMAIN=$2
24 LIST_URL=$3
25 LIST_USER=$4
26 LIST_PASS=$5
27fi
28
29sudo -u list $BIN/newlist $LIST_NAME@$LIST_DOMAIN $LIST_USER@hcoop.net \
30 $LIST_PASS </dev/null
31
32# By default, use our list admin website for the public interface.
33# This can be changed after the user has set up their mailMan
34# directive. We do this because the default is
35# http://lists.hcoop.net, without SSL, which makes list admin not work
36# at all.
37/afs/hcoop.net/common/etc/scripts/change-list-url $LIST_NAME $LIST_URL
38
39echo "Sucessfully created list $LIST_NAME"