1# nnspew -- generate subject line database
2#
3# From: James A. Woods (ames!jaw), NASA Ames Research Center
4#
5# Updates the auxiliary 'subjects' file.  It must be activated regularly
6# via a system-wide 'cron' or 'at' command, e.g.
7#
8# 	2 6,9,12,15,18,21 * * *  root /bin/nice /usr/lib/nn/nnspew
9
10trap "rm -f $TMP/nnsubj$$* ; exit" 0 1 2 15
11
12# We use a "secret" 'nn -SPEW' call to do the hard part:
13
14if $BIN/nn -SPEW < /dev/null > $TMP/nnsubj$$a
15then
16	if sort -u $TMP/nnsubj$$a > $TMP/nnsubj$$b
17	then
18		mv $TMP/nnsubj$$b $DB/subjects
19		chmod 644 $DB/subjects
20	fi
21fi
22