1837971 Members
3531 Online
110124 Solutions
New Discussion

Re: Filesize management

 
SOLVED
Go to solution
Fritz Zephir
New Member

Filesize management

I have to monitor a couple of files in a couple of directories,files are daily log files, which beyond 10mb do not log anymore, a situation I'd like to prevent.

Filenaming is BLAxxxxMMDDBLA may be any 3 or 4 characters string,, couple of numbers(more than 4), MMDD being month and date

I've done something basic which i've attached

Is there a better way? Could the world be a better place?
I said UNIX not eunuchs
2 REPLIES 2

Re: Filesize management

You could always put a job in cron that loops every X minutes.

There is always TCL or PERL
If it ain't rough it ain't me
Steve Steel
Honored Contributor
Solution

Re: Filesize management

Hi

Play with this

for cef in loga logb loc logd loge
do
dateval=$(date '+%d%m%y%H%M%S')
xx=$(find $PWD -name $cef* -size 95000000c)
for file in $xx
do
cp -p $file $file"."$dateval
cat /dev/null > $file
done
done


Finds all fils starting name* of the size or bigger and copies to name.date and zeroes them


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)