Xref: utzoo news.sysadmin:2341 news.software.b:2204 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!lll-winken!uunet!bfmny0!tneff From: tneff@bfmny0.UUCP (Tom Neff) Newsgroups: news.sysadmin,news.software.b Subject: Cleanup script Summary: puts all expires etc in one place Message-ID: <14313@bfmny0.UUCP> Date: 8 May 89 20:19:11 GMT Reply-To: tneff@bfmny0.UUCP (Tom Neff) Followup-To: news.sysadmin Organization: - Lines: 70 Expires: Sender: Followup-To: Distribution: Keywords: I used to put a lot of individual expires into the root crontab, which meant every time I wanted to adjust things I had to mess with cron. I wasn't satisfied with the logging of this either. So I wrote a general purpose cleanup shell script where I can specify all the individual expires, trims, logging etc for news. Perhaps others may find it useful. I call it "cleannews": ---cut here------cut here------cut here------cut here------cut here--- #! /bin/sh # '@(#)cleannews 1.2 05/03/89' # Perform news cleanup. This script should be run nightly from the # root crontab. The distributed version performs a general news expire # and trims the log files. You can add newsgroup-specific expires and # any other news related stuff you want to run nightly. Keeping # everything together in one shell script lets you manage netnews # flexibly without changing 'crontab' all the time. Cleannews also # writes a logfile (including error codes). This logfile is not # itself cleaned automatically but it should only grow by a few # lines per night. To turn it off, set Logfile=/dev/null. # # This version was tested with the news 2.11 software but should # work most anywhere. # set -vx # uncomment for debugging # Customize these values (if necessary) for your site. Date=/bin/date Expire=/usr/lib/news/expire Trimlib=/usr/lib/news/trimlib Logfile=/usr/lib/news/cleannews.log # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Add copies of the following block for any specific # expires you want to run besides the general expire. # # Customize the following values for each expire: KEEPNEWS=14 KEEPHIST=30 VERBOSE=0 OUTPUT="> /dev/null" GROUPS=all if $Expire -e $KEEPNEWS -E $KEEPHIST -v $VERBOSE -n $GROUPS $OUTPUT then RC=; else RC="?? exit code $? ??" ; fi $Date "+%D %T expire $GROUPS $RC" >> $Logfile # End of expire block # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # This is the news logfile trimmer from the news 2.11 'misc' directory if $Trimlib then RC=; else RC="?? exit code $? ??" ; fi $Date "+%D %T trimlib $RC" >> $Logfile ---cut here------cut here------cut here------cut here------cut here--- -- Tom Neff UUCP: ...!uunet!bfmny0!tneff "Truisms aren't everything." Internet: tneff@bfmny0.UU.NET