longjohnsilver has asked for the wisdom of the Perl Monks concerning the following question:
1.Check if the filesystem is filling up for over 10Glogfile_22102008_1051.txt.gz
The sizes of the files are the same but the number of them may vary a lot. At this point my question is, since my code doesn't seem to work (it deletes all my .gz files) , how can i delete the "oldest day" files during every step of the filesystem size check? Is this the best solution? I have to keep the filesystem almost full to retain as much info as possible, but i need necessarily to delete the oldest ones because information arrives continously. I hope my explanation is clear enough; Thx Francescomy $LOGSIZE = `du -s $LOGSTR | /bin/awk '{print \$1}'`; chomp( $LOGSTR + ); my $I = 5; my $S; # Up to 10G while ( $LOGSIZE > 10000000 && $I >= -1 ) { if ( $I <= -1 ) { $S = ""; } else { $S = "+"; } my $LOGSIZE = `du -s $LOGSTR | /bin/awk '{print \$1}'`; chomp( + $LOGSTR ); `/usr/bin/find $LOGSTR -name "*.gz" -print -mtime $S$I -exec r +m \{\} \\\;`; sleep 2; $I--; } ---
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Deleting Oldest Logfiles
by moritz (Cardinal) on Oct 22, 2008 at 15:48 UTC | |
by longjohnsilver (Acolyte) on Oct 23, 2008 at 11:44 UTC | |
by moritz (Cardinal) on Oct 23, 2008 at 11:49 UTC | |
by longjohnsilver (Acolyte) on Oct 24, 2008 at 07:18 UTC | |
|
Re: Deleting Oldest Logfiles
by Illuminatus (Curate) on Oct 22, 2008 at 15:32 UTC | |
by kyle (Abbot) on Oct 22, 2008 at 15:42 UTC | |
|
Re: Deleting Oldest Logfiles
by kyle (Abbot) on Oct 22, 2008 at 15:57 UTC | |
|
Re: Deleting Oldest Logfiles
by toolic (Bishop) on Oct 22, 2008 at 15:25 UTC |