BSD 4_3_Tahoe development
[unix-history] / usr / lib / uucp / clean.daily
CommitLineData
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#
6set files=( SYSLOG LOGFILE ERRLOG )
7set days=30
8set spooldir=/usr/spool/uucp
9set archdir=uucplog.archives
10#
11cd $spooldir
12if ( ! -e $archdir ) mkdir $archdir
13#
14# get today's files out of the way immediately
15#
16foreach file ( $files )
17 mv -f $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 -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
34end
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
41cd /usr/lib/uucp
42uuclean -pLTMP. -n24
43uuclean -d/usr/spool/uucp/TM. -pTM. -n240
44uuclean -d/usr/spool/uucp/X. -pX. -n240
45uuclean -d/usr/spool/uucp/C. -pC. -n240
46uuclean -d/usr/spool/uucp/D. -pD. -n240
47uuclean -d/usr/spool/uucp/D.`uuname -l` -pD. -n240
48uuclean -d/usr/spool/uucp/D.`uuname -l`X -pD. -n240