blob: b160ba5c678151a076d2be0b16259ddc81d8ff8c (
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/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
|