aboutsummaryrefslogtreecommitdiff
path: root/mlmmj-update-archive.sh
diff options
context:
space:
mode:
Diffstat (limited to 'mlmmj-update-archive.sh')
-rwxr-xr-xmlmmj-update-archive.sh43
1 files changed, 43 insertions, 0 deletions
diff --git a/mlmmj-update-archive.sh b/mlmmj-update-archive.sh
new file mode 100755
index 0000000..b160ba5
--- /dev/null
+++ b/mlmmj-update-archive.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+# Updates the mlmmj mailing list archive with new messages since last run based
+# on the last index in $LASTINDEX and the latest index in the $LISTDIR
+#
+# 2006 Martin Leopold <leopold@diku.dk>
+# 2025 Robin Haberkorn <rhaberkorn@fmsbw.de>
+#
+# Based on http://www.leopold.dk/~martin/stuff/update-archive.sh
+
+if [ $# -le 1 ]; then
+ echo "Grrr.."
+ echo "\$1 - name of the archive"
+ echo "\$2 - www dir"
+ echo "\$3 - list dir"
+ exit 0
+fi
+
+LABEL=$1
+WWWDIR=$2
+LISTDIR=$3
+LASTINDEXFILE=$WWWDIR/last
+NEWINDEX=`cat $LISTDIR/index`
+LASTINDEX=`cat $LASTINDEXFILE`
+HYPERMAIL="/usr/local/bin/hypermail"
+
+if [ -z "$LASTINDEX" ]; then
+ LASTINDEX=0
+fi
+
+if [ $LASTINDEX -ge $NEWINDEX ]; then
+ exit
+fi
+
+for IT in `seq $(($LASTINDEX+1)) $NEWINDEX`; do
+ $HYPERMAIL -l $LABEL -i -u -d $WWWDIR < $LISTDIR/archive/$IT
+done
+
+echo $NEWINDEX > $LASTINDEXFILE
+
+# Script should perhaps be run as the www user
+# But we cannot currently read from the mailing list archive.
+chown -R www:www $WWWDIR