|
|
1.1 root 1: #!/bin/csh -f
2: #
3: # Once a day, move the log files to the archive directory,
4: # keep them for 30 days, and then get rid of them.
5: #
6: set files=( SYSLOG LOGFILE ERRLOG )
7: set days=30
8: set spooldir=/usr/spool/uucp
9: set archdir=uucplog.archives
10: #
11: if ( ! -e $archdir ) mkdir $archdir
12: cd $spooldir
13: #
14: # get today's files out of the way immediately
15: #
16: foreach file ( $files )
17: mv $file o$file
18: cp /dev/null $file
19: chmod 664 $file
20: end
21: #
22: # now move things around in the archive directory
23: #
24: foreach file ( $files )
25: set x=$days
26: while($x > 0)
27: @ y = $x - 1
28: if ($x == $days) rm $archdir/$file.$x
29: mv -f $archdir/$file.$y $archdir/$file.$x
30: @ x --
31: end
32: mv o$file $archdir/$file.0
33: end
34:
35: # this assumes you have subdirectories.
36: # If you do not have them, delete the '-d....' options below.
37: # someone should use shell variables to do this
38: # Much better to have subdirectories, however.
39:
40: cd /usr/lib/uucp
41: uuclean -pLTMP. -n24
42: uuclean -d/usr/spool/uucp/TM. -pTM. -n240
43: uuclean -d/usr/spool/uucp/X. -pX. -n240
44: uuclean -d/usr/spool/uucp/C. -pC. -n240
45: uuclean -d/usr/spool/uucp/D. -pD. -n240
46: uuclean -d/usr/spool/uucp/D.`uuname -l` -pD. -n240
47: uuclean -d/usr/spool/uucp/D.`uuname -l`X -pD. -n240
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.