geoff@desint.UUCP (Geoff Kuenning) (11/18/84)
The following script locates all files in the usenet spool directory that
are not listed in the history file. Since "expire" runs off of the history
file, these are files that will never be removed from the spooling
directories.
Cut at the line below, and don't forget to also remove my signature at the
end!
------------------------CUT HERE-----------------------------
#!/bin/sh
#
# %W% %G% %U%
#
# Compare the usenet history file with the actual contents of the
# spool directories, and report any discrepancies.
#
# Usage:
#
# histmiss libdir spooldir [extra find options]
#
# If no find options are given, all plain files in the spool directories
# are reported, even if they do not have an all-numeric name.
#
# Examples:
#
# To remove anything that is not in the history file:
#
# histmiss /usr/{lib,spool}/news | xargs rm -f
#
# To remove anything that is both not in the history file, and is more
# than two weeks old (this could be run on a daily basis as a backup
# form of expire):
#
# histmiss /usr/{lib,spool}/news -mtime +14 | xargs rm -f
#
LIBDIR=$1
SPOOLDIR=$2
shift; shift
TEMP=/tmp/hm$$
PATH=/bin:/usr/bin
export PATH
trap "rm -f $TEMP; exit 1" 1 2 15
cut '-d ' -f3- $LIBDIR/history | tr . / | tr -s ' ' \\012 | sort -u > $TEMP
cd $SPOOLDIR
find . -type f $* -print | sed 's/^\.\///' | sort -u | comm -23 - $TEMP
rm -f $TEMP
exit 0
------------------------CUT HERE-----------------------------
--
Geoff Kuenning
First Systems Corporation
...!ihnp4!trwrb!desint!geoffavolio@grendel.UUCP (Frederick M. Avolio) (11/23/84)
> The following script locates all files in the usenet spool directory that > are not listed in the history file. Since "expire" runs off of the history > file, these are files that will never be removed from the spooling > directories. A good script and useful, too! I modified it to run on non-USG systems (without cut and xarg). Cut at the line below, and don'forget to remove my signature at the end. ------------------------CUT HERE----------------------------- #!/bin/sh # # Version for 4.2BSD # # %W% %G% %U% # # Compare the usenet history file with the actual contents of the # spool directories, and report any discrepancies. # # Usage: # # histmiss libdir spooldir [extra find options] # # If no find options are given, all plain files in the spool directories # are reported, even if they do not have an all-numeric name. # # Examples: # # To remove anything that is not in the history file: # # rm -f `histmiss /usr/{lib,spool}/news` # # To remove anything that is both not in the history file, and is more # than two weeks old (this could be run on a daily basis as a backup # form of expire): # # rm -f `histmiss /usr/{lib,spool}/news -mtime +14` # LIBDIR=$1 SPOOLDIR=$2 shift; shift TEMP=/tmp/hm$$ PATH=/bin:/usr/bin export PATH trap "rm -f $TEMP; exit 1" 1 2 15 awk -F\t '{ print $3 }' $LIBDIR/history | tr . / | tr -s ' ' \\012 | sort -u > $TEMP cd $SPOOLDIR find . -type f $* -print | sed 's/^\.\///' | sort -u | comm -23 - $TEMP rm -f $TEMP exit 0 ------------------------CUT HERE----------------------------- -- Fred Avolio, DEC -- U{LTR,N}IX Support 301/731-4100 x4227 UUCP: {seismo,decvax}!grendel!avolio ARPA: grendel!avolio@seismo.ARPA