29 lines
616 B
Bash
Executable File
29 lines
616 B
Bash
Executable File
#! /bin/ksh
|
|
|
|
# This script trims the number of files in the main build log directory
|
|
# It can also be used to trim other log files
|
|
# marca 2/7/90
|
|
USAGE="cleanLogs [logdir] [number of logs left]"
|
|
|
|
# defaults
|
|
LOGSLEFT=14
|
|
LOGDIR=/x/logs/build
|
|
[ $# -gt 1 ] && LOGSLEFT=$2
|
|
[ $# -gt 0 ] && LOGDIR=$1
|
|
|
|
#clean up the log files because dere be too many
|
|
echo ""
|
|
echo "***************************************"
|
|
echo "START Trimming log files"
|
|
cd $LOGDIR
|
|
LOGS=`ls -rt`
|
|
set -- $LOGS
|
|
|
|
while [ $# -gt $LOGSLEFT ]
|
|
do
|
|
#eliminate last log file
|
|
echo "Trying to delete $1"
|
|
rm -rf $1 || echo "could not delete $1"
|
|
shift
|
|
done
|