#!/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