|
|
1.1 root 1: : check active file for missing or extra newsgroups
2: : '@(#)checkgroups 1.12 1/17/86'
3:
4: # Read first line of stdin. If of the form "-n group", then only check
5: # for the specified group. Otherwise, assume doing net and fa.
6: sed -e '/^[a-zA-Z-]*: /d' -e '/^$/d' -e '/^[#:]/d' | (
7: read line
8: case "${line}" in
9: -n*)
10: # Doing specific group. extract group name and preserve
11: # all of current newsgroups file except for that group.
12: # Then append entries for this group.
13: group=`echo ${line} | sed -e 's/-n /^/' -e 's/$/\\\\./'`
14: egrep -v "${group}" LIBDIR/newsgroups > /tmp/$$a
15: cat /tmp/$$a - > LIBDIR/newsgroups
16: ;;
17: *)
18: group="^net\\.|^fa\\.|^mod\\."
19: egrep -v "${group}" LIBDIR/newsgroups > /tmp/$$a
20: cat /tmp/$$a > LIBDIR/newsgroups
21: echo "${line}" >> LIBDIR/newsgroups
22: cat >> LIBDIR/newsgroups
23: ;;
24: esac
25: echo junk >/tmp/$$a
26: echo control >>/tmp/$$a
27: sed 's/[ \ ].*//' LIBDIR/newsgroups |
28: egrep "${group}|^general" >>/tmp/$$a
29: sort -u /tmp/$$a -o /tmp/$$a
30: egrep "${group}|^general|^junk|^control" LIBDIR/active | sed 's/ .*//' | sort -u >/tmp/$$b
31:
32: comm -13 /tmp/$$a /tmp/$$b >/tmp/$$remove
33: comm -23 /tmp/$$a /tmp/$$b >/tmp/$$add
34:
35: if test -s /tmp/$$remove
36: then
37: (
38: echo "The following newsgroups are not valid and should be removed."
39: sed "s/^/ /" /tmp/$$remove
40: echo ""
41: echo "You can do this by executing the command:"
42: echo \ LIBDIR/rmgroup `cat /tmp/$$remove`
43: echo ""
44: ) 2>&1 >/tmp/$$out
45: fi
46:
47: if test -s /tmp/$$add
48: then
49: (
50: echo "The following newsgroups were missing and should be added."
51: sed "s/^/ /" /tmp/$$add
52: echo ""
53: echo "You can do this by executing the command(s):"
54: for i in `cat /tmp/$$add`
55: do
56: echo 'LIBDIR/inews -n control -d local -t "cmsg newgroup '$i'" </dev/null'
57: done
58: ) 2>&1 >>/tmp/$$out
59: fi
60:
61: if test -s /tmp/$$out
62: then
63: (echo "Subject: Problems with your active file"
64: echo ""
65: cat /tmp/$$out
66: ) | if test $# -gt 0
67: then
68: mail $1
69: else
70: cat
71: fi
72: fi
73: )
74:
75: rm -f /tmp/$$*
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.