snnewsq.in 1.02 KB
Newer Older
1 2 3 4 5 6 7 8 9
#!/bin/sh

# news queue statistics for sn
# by Andras BALI <drewie@bigfoot.com>
# modified by Jorgen Schaefer <forcer@mindless.com>

SNSPOOL=${SNROOT:-!!SNROOT!!}

for i in $SNSPOOL/.outgoing/*; do
Hilko Bengen's avatar
Hilko Bengen committed
10
    if [ "$i" = "$SNSPOOL/.outgoing/*" ]
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
    then
	echo "Can't read from $SNSPOOL/.outgoing/, exiting."
	break
    fi
    servername=$(basename $i | cut -d: -f1)
    files=$(find $i/ -type f -not -name .lock \
                             -not -name .last-list \
                             -not -name password \
                             -not -name username)
    if [ -z "$files" ]; then
	echo No outgoing articles for $servername
    else
	NUM=$(echo "$files" | wc -l | tr -d ' ')
	if [ $NUM -eq 1 ]; then ARTICLES=article ; else ARTICLES=articles ; fi
	echo $NUM outgoing $ARTICLES for $servername:
	k=1
	echo "$files" | while read j; do
	    echo -n "-> $k.  "; grep "Newsgroups: " $j | head -1
	    echo -n "       ";  grep "Subject: " $j | head -1
	    echo -n "       ";  grep "Date: " $j | head -1
	    k=$((k + 1))
	done
    fi
done