mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
28 lines
616 B
Bash
Executable file
28 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
|