Posted by veg_all on 11/29/06 23:26
Thanks for the replies. Here is what I came up with in Perl : Ill
transfer to php since I need it there as well.
sub check_log_size {
my $size = ( -s 'log' ) / 1024 ;
$size = int $size;
if ( $size > 25 ) {
open (FILEHANDLE1, "log" ) || &die_sub ( "Cant open log");
open (FILEHANDLE2, ">log_old" );
while (<FILEHANDLE1>) { print FILEHANDLE2 $_; }
close (FILEHANDLE1);
close (FILEHANDLE2);
unlink ( 'log' );
}
} # end sub
Navigation:
[Reply to this message]
|