1#!/bin/sh 2: '/********************************************************************* 3 uucp.daily 4 5 Sccsid=@(#)uucp.daily 1.1 6 7 usage: 8 Called from cron in the wee early hours of the morning 9 10 arguments: 11 none. 12 13 history: 14 long time ago original version 15 07/02/82 revisions to month change handling 16 *********************************************************************/' 17 18: 'daily UUCP cleanup' 19: 'called in the morning' 20 21uulib=/usr/lib/uucp 22spool=/usr/spool/uucp 23olddir="$spool/OLD" 24b=/usr/local/lib 25PATH="/usr/new:/usr/ucb:/usr/local:/bin:/usr/bin" ; export PATH 26 27uulog 28$uulib/uuclean -m -p LCK. -p X. -p D. -p C. -p TM. 29$uulib/uuclean -p STST. -n 12 30 31set `date` 32day=$1 33month=$2 34daymon=$3 35 36: '************************************************************ 37 Old spool/log files are kept by the naming scheme: 38 LOGFILE.${day}${daymon} where ${day} is the day of 39 the week (Sun-Sat), and ${daymon} is the numerical 40 day of the month. SYSLOG files are kept by the scheme: 41 SYSLOG.week: the current weeks: totals; SYSLOG.month: 42 the current months totals; SYSLOG.${month} where 43 ${month} is the first three letters of the month: the 44 totals for that month. 45 ************************************************************' 46cd $spool 47mv LOGFILE $olddir/LOGFILE.${day}${daymon} 48mv SYSLOG SYSLOG.$$ 49cat SYSLOG.$$ >>$olddir/SYSLOG.week 50rm -f SYSLOG.$$ 51 52: 'clean up UUCP logfiles' 53cd $olddir 54 55: 'save the current SYSLOG in a monthly summary 56 each Monday. 57 ' 58case $day in 59Mon) cat SYSLOG.week >>SYSLOG.month 60 rm -f SYSLOG.week 61 ;; 62esac 63 64: 'Create monthly name file if necessary' 65if [ ! -f logmonth ] 66then 67 echo $month >logmonth 68 curmonth=$month 69else 70 curmonth=`cat logmonth` 71fi 72 73: 'If the month has wrapped around, save the monthly 74 summary by the name of the month 75 ' 76if [ $month != $curmonth ] 77then 78 if [ -f SYSLOG.week ] 79 then 80 cat SYSLOG.week >>SYSLOG.month 81 rm -f SYSLOG.week 82 fi 83 mv SYSLOG.month SYSLOG.$curmonth 84 echo $month >logmonth 85 uuusage $curmonth >UUUSAGE.${curmonth} 86fi 87 88: 'Remove LOGFILEs older than three days; save SYSLOG 89 files forever (remove manually) 90 ' 91find . -name 'LOGFILE.*' -mtime +3 -exec rm -f {} \; 92