#!/bin/csh -f # # Once a day, move the log files to the archive directory, # keep them for 30 days, and then get rid of them. # set files=( SYSLOG LOGFILE ERRLOG ) set days=30 set spooldir=/usr/spool/uucp set archdir=uucplog.archives # if ( ! -e $archdir ) mkdir $archdir cd $spooldir # # get today's files out of the way immediately # foreach file ( $files ) mv $file o$file cp /dev/null $file chmod 664 $file end # # now move things around in the archive directory # foreach file ( $files ) set x=$days while($x > 0) @ y = $x - 1 if ($x == $days) rm $archdir/$file.$x mv -f $archdir/$file.$y $archdir/$file.$x @ x -- end mv o$file $archdir/$file.0 end # this assumes you have subdirectories. # If you do not have them, delete the '-d....' options below. # someone should use shell variables to do this # Much better to have subdirectories, however. /usr/sbin/uuclean -pLTMP. -n24 /usr/sbin/uuclean -d/usr/spool/uucp/TM. -pTM. -n240 /usr/sbin/uuclean -d/usr/spool/uucp/X. -pX. -n240 /usr/sbin/uuclean -d/usr/spool/uucp/C. -pC. -n240 /usr/sbin/uuclean -d/usr/spool/uucp/D. -pD. -n240 /usr/sbin/uuclean -d/usr/spool/uucp/D.`uuname -l` -pD. -n240 /usr/sbin/uuclean -d/usr/spool/uucp/D.`uuname -l`X -pD. -n240