]> Pileus Git - ~andy/fetchmail/blob - dist-tools/listsize
Add security announcer script.
[~andy/fetchmail] / dist-tools / listsize
1 #!/bin/sh
2 #
3 # Mine list sizes from MailMan web interfaces
4 #
5 # * Must set environment variable FETCHMAIL_LIST_PASS to list admin password
6
7 project="fetchmail"
8 admin="http://lists.berlios.de/mailman/admin"
9 adminpw=$FETCHMAIL_LIST_PASS
10
11 list="$1"
12 if [ ! "$list" ]; then
13         echo "Usage: $0 list" 1>&2
14         exit 1
15 fi
16 case "$list" in
17 $project-*)
18         # already gave us the full name, e.g. fetchmail-announce
19         ;;
20 *)
21         # only gave us the last part of the name, e.g. announce
22         list="$project-$list"
23         ;;
24 esac
25
26 hexpw=`echo "$adminpw" | od -t x1 -w64 | sed -e 's/^[0-9]*//' -e '/^ *$/d' -e 's/ /%/g'`
27 umask 077
28 tmp="/tmp/$project-$list.listsize.$$"
29 # First get the login cookie...
30 curl -s -D "$tmp" "$admin/${list}?adminpw=$hexpw" >/dev/null
31 # Second gets the actual stat
32 curl -s -b "$tmp" "$admin/${list}/members" \
33         | sed -n '/.*>(\([0-9][0-9]*\) members total.*/s//\1/p'
34 rm -f "$tmp"
35 # end
36