From 94c49df7dd27629d6a28f50028db483085907c96 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Mon, 6 Oct 2025 01:06:30 +0300 Subject: added scripts used for administration of fmsbw.de --- mlmmj-update-archive.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 mlmmj-update-archive.sh (limited to 'mlmmj-update-archive.sh') 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 +# 2025 Robin Haberkorn +# +# 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 -- cgit v1.2.3