summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2012-01-31 22:02:00 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2012-01-31 22:02:00 +0100
commit52b666c8dff60f50becafbf60c6e7fdeab96ab41 (patch)
tree8399df06dad6f8eed30c09c9db300cf5e4008234
parent7a9c005fa05aaf54a9d6a6d3359bbec9bca6203b (diff)
downloadcontrib-52b666c8dff60f50becafbf60c6e7fdeab96ab41.tar.gz
contrib-52b666c8dff60f50becafbf60c6e7fdeab96ab41.tar.bz2
contrib-52b666c8dff60f50becafbf60c6e7fdeab96ab41.zip
neueliste: added wrapper script for newlist from mailman
this script is used for locking the access to the mailman script, analyse the output and report errors to the html page
-rwxr-xr-xneueliste.bash39
1 files changed, 39 insertions, 0 deletions
diff --git a/neueliste.bash b/neueliste.bash
new file mode 100755
index 0000000..e4f7c5d
--- /dev/null
+++ b/neueliste.bash
@@ -0,0 +1,39 @@
+#!/bin/zsh
+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 su mailman -c "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/index.php">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/index.php">back</a> in your browser and enter another name for your mailinglist. Thank you.<br><hr>debug info:"
+ else
+ echo "Oh, das 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 !<br><br><pre>"
+ cat $TMPFILE
+ echo "</pre>"
+
+ 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