#!/bin/csh -fv # # rotatelogs.sh - Kevin P. Inscoe - 6/15/99 # # Reads in /etc/rotate or /opt/etc/rotate and rotates and # compresses log files first in original directory then after # threshold is reached onto archive if one is defined and # exists. # # Global variables set vers = "1.0" set etc = "/etc/rotate /opt/etc/rotate" # Announce ourselves /bin/echo $0 "beginning at" `/bin/date` # Decide which etc file to use in search order foreach f ( $etc ) if ( -r $f ) then set xetc = $f goto set_file endif end set_file: if ( $?xetc ) then set etc_file = $xetc /bin/echo $0 "reading file" $etc_file else /bin/echo $0 "error:" $etc "files not found - aborting at" `/bin/date` exit 1 endif # Parse and store the files to rotate and parameters