ITEM: BF8292L
DB2/6000 - When Can I rm a log file and how to automate the process
DESC:
I am using archive logging and would like to know when I can
remove my old logs.
.
QUESTIONS
==========
What is the rule of thumb on this?
Can I remove these logs from the user exit program?
If not what is an alternative?
.
ACTION:
RULE of THUMB
==============
1. Keep all logs since your last backup.
2. From those logs which are older than your last backup keep
only the logs that go back to the furtherest point to which
you may have cause to roll back.
You can remove the files from the user exit program if you
choose to rewrite the program to do this.
Following is a fairly short script to remove old files. It will
do very basic error checking and will only remove files. A log is
kept if the files which are being removed. The script is inclosed
below:
______________________ .rmdata ________________________________________
\#! /bin/ksh
typeset -i DAYS
usage()
{ print " Usage: .rmdate -p {Absolute Directory Path} -d days"
print " example to remove files older than 4 days in /tmp"
print " .rmdate -p /tmp -d 4"
}
if [ "$\#" -ne 4 ]
then
usage
exit 1
fi
while [ "$\#" -ne 0 ]
do
case "$1" in
-p) STORAGE=$2
if [ ! -d ${STORAGE} ]
then
print "Directory does not exist"
exit 1
fi
shift; shift;;
-d) DAYS=$2
shift; shift;;
*) echo "Invalid flag"
usage
exit 2
esac
done
cd ${STORAGE}
print "The following files were removed on `date`" > /archive_rm.log
find ${STORAGE} -type f -print -ctime +${DAYS} -exec /bin/ls -l {} \\; \\
>> /archive_rm.log
find ${STORAGE} -type f -print -ctime +${DAYS} -exec /bin/rm -f {} \\; \\
1> /dev/null
exit 0
________________________________________________________________________
Support Line: DB2/6000 - When Can I rm a log file and how to automate the process ITEM: BF8292L
Dated: March 1996 Category: N/A
This HTML file was generated 99/06/24~13:30:22
Comments or suggestions?
Contact us