Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site grendel.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!umcp-cs!aplvax!grendel!avolio From: avolio@grendel.UUCP (Frederick M. Avolio) Newsgroups: net.sources Subject: Re: Shell script to list what's NOT in the history file Message-ID: <208@grendel.UUCP> Date: Fri, 23-Nov-84 09:11:08 EST Article-I.D.: grendel.208 Posted: Fri Nov 23 09:11:08 1984 Date-Received: Sat, 24-Nov-84 20:56:12 EST References: <223@desint.UUCP> Organization: DEC, DC Area Gov't Projects Group Lines: 57 > 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