summaryrefslogtreecommitdiffstats
path: root/neueliste.bash
blob: 8299ebcfbdfa65fe8bb4b8cf89ba6cc5ba7ae9e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/zsh

if [ $# -ne 3 ]; then
  echo "Interner Fehler: Ungültige Anzahl Parameter"
  echo "internal error: invalid number of parameters"
fi

LOCKFILE=/tmp/newlist

lockfile-create --retry 1 $LOCKFILE >/dev/null 2>&1
if [[ "$?" != "0" ]]
then
  echo "Konnte die Mailingliste nicht erstellen. Bitte versuchen Sie es noch einmal. (Diese Seite neu zu laden sollte ausreichen.)"
  echo "Could not create your mailinglist. Please retry creation. (Reloading this page should be sufficient.)"
  exit 1
fi

TMPFILE=/tmp/newlistoutput$(date -Is)

if echo | ~mailman/bin/newlist -- "$1" "$2" "$3" > $TMPFILE 2>&1
then
  echo "Erstellung erfolgreich -- creation completed"

  rm -f $TMPFILE
  lockfile-remove $LOCKFILE
else
  echo "<h2><font color="red">ERSTELLUNG FEHLGESCHLAGEN / CREATION FAILED</font></h2>"

  if grep "List already exists" $TMPFILE >/dev/null 2>&1
  then
        echo "Bitte im Browser auf <a href="/neu/">Zur&uuml;ck</a> klicken und einen anderen Namen f&uuml;r die Mailingliste w&auml;hlen! Danke.<br>"
        echo "Please click on <a href="/neu/">back</a> in your browser and enter another name for your mailinglist. Thank you.<br><hr>debug info:"
  else
        echo "Oh, da ist was schief gegangen. Bitte mailman@lists.spline.de kontaktieren!<br>"
        echo "Oops, something went wrong here. Please contact the admins at mailman@lists.spline.de !"

        cat $TMPFILE | mailx -s "$0: Mailinglistenerstellung fehlgeschlagen 1=($1) 2=($2) 3=($3)" mailman@lists.spline.de
  fi  

  rm -f $TMPFILE
  lockfile-remove $LOCKFILE
  exit 1
fi