Commit | Line | Data |
---|---|---|
ba9e10f8 C |
1 | #!/bin/csh -f |
2 | # | |
3 | # Once a day, move the log files to the archive directory, | |
4 | # keep them for $days 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 | cd $spooldir | |
12 | if ( ! -e $archdir ) mkdir $archdir | |
13 | # | |
14 | # get today's files out of the way immediately | |
15 | # | |
16 | foreach file ( $files ) | |
17 | mv -f $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 -f $archdir/$file.$x | |
29 | if ( -e $archdir/$file.$y ) \ | |
30 | mv -f $archdir/$file.$y $archdir/$file.$x | |
31 | @ x -- | |
32 | end | |
33 | mv -f o$file $archdir/$file.0 | |
34 | end | |
35 | ||
36 | # this assumes you have subdirectories. | |
37 | # If you do not have them, delete the '-d....' options below. | |
38 | # someone should use shell variables to do this | |
39 | # Much better to have subdirectories, however. | |
40 | ||
41 | cd /usr/lib/uucp | |
42 | uuclean -pLTMP. -n24 | |
43 | uuclean -d/usr/spool/uucp/TM. -pTM. -n240 | |
44 | uuclean -d/usr/spool/uucp/X. -pX. -n240 | |
45 | uuclean -d/usr/spool/uucp/C. -pC. -n240 | |
46 | uuclean -d/usr/spool/uucp/D. -pD. -n240 | |
47 | uuclean -d/usr/spool/uucp/D.`uuname -l` -pD. -n240 | |
48 | uuclean -d/usr/spool/uucp/D.`uuname -l`X -pD. -n240 |