#!/bin/sh
trap "rm -f \$LIBDIR/\$temp; exit 1" 1 2 3 4 5 6 7 8 10 12 13 14 15 16

NOTESUSR=notes
LIBDIR=`awk -F: "/^$NOTESUSR:/ {print \\$6;exit}" /etc/passwd`
SPOOL=$1

temp=Atmp$$

cd $SPOOL
find . -name BODY.TEXT -print | sed 's/^\.\///
				     s/\/BODY.TEXT//
				     s/\//./g' >$LIBDIR/$temp
echo "!!Active files:" `wc -l <$LIBDIR/$temp` >>$LIBDIR/$temp
sort -o $LIBDIR/$temp $LIBDIR/$temp

#This reduces the odds of corruption by another parallel run
mv $LIBDIR/$temp $LIBDIR/Active
chmod 0664 $LIBDIR/Active
