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