File: snnewsq

package info (click to toggle)
sn 0.3.8-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, sid, trixie
  • size: 976 kB
  • sloc: ansic: 9,255; sh: 467; makefile: 210
file content (34 lines) | stat: -rwxr-xr-x 1,047 bytes parent folder | download
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
#!/bin/sh

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

SNSPOOL=${SNROOT:-/var/spool/sn}

for i in $SNSPOOL/.outgoing/*; do
    if [ "$i" = "$SNSPOOL/.outgoing/*" ]
    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