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#
6set files=( SYSLOG LOGFILE ERRLOG )
7set days=30
8set spooldir=/usr/spool/uucp
9set archdir=uucplog.archives
10#
11if ( ! -e $archdir ) mkdir $archdir
12cd $spooldir
13#
14# get today's files out of the way immediately
15#
16foreach file ( $files )
17	mv $file o$file
18	cp /dev/null $file
19	chmod 664 $file
20end
21#
22# now move things around in the archive directory
23#
24foreach 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
33end
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
40cd /usr/lib/uucp
41uuclean -pLTMP. -n24
42uuclean -d/usr/spool/uucp/TM. -pTM. -n240
43uuclean -d/usr/spool/uucp/X. -pX. -n240
44uuclean -d/usr/spool/uucp/C. -pC. -n240
45uuclean -d/usr/spool/uucp/D. -pD. -n240
46uuclean -d/usr/spool/uucp/D.`uuname -l` -pD. -n240
47uuclean -d/usr/spool/uucp/D.`uuname -l`X -pD. -n240
48