|
|
1.1 root 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:
21: uulib=/usr/lib/uucp
22: spool=/usr/spool/uucp
23: olddir="$spool/OLD"
24: b=/usr/local/lib
25: PATH="/usr/new:/usr/ucb:/usr/local:/bin:/usr/bin" ; export PATH
26:
27: uulog
28: $uulib/uuclean -m -p LCK. -p X. -p D. -p C. -p TM.
29: $uulib/uuclean -p STST. -n 12
30:
31: set `date`
32: day=$1
33: month=$2
34: daymon=$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: ************************************************************'
46: cd $spool
47: mv LOGFILE $olddir/LOGFILE.${day}${daymon}
48: mv SYSLOG SYSLOG.$$
49: cat SYSLOG.$$ >>$olddir/SYSLOG.week
50: rm -f SYSLOG.$$
51:
52: : 'clean up UUCP logfiles'
53: cd $olddir
54:
55: : 'save the current SYSLOG in a monthly summary
56: each Monday.
57: '
58: case $day in
59: Mon) cat SYSLOG.week >>SYSLOG.month
60: rm -f SYSLOG.week
61: ;;
62: esac
63:
64: : 'Create monthly name file if necessary'
65: if [ ! -f logmonth ]
66: then
67: echo $month >logmonth
68: curmonth=$month
69: else
70: curmonth=`cat logmonth`
71: fi
72:
73: : 'If the month has wrapped around, save the monthly
74: summary by the name of the month
75: '
76: if [ $month != $curmonth ]
77: then
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}
86: fi
87:
88: : 'Remove LOGFILEs older than three days; save SYSLOG
89: files forever (remove manually)
90: '
91: find . -name 'LOGFILE.*' -mtime +3 -exec rm -f {} \;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.