#740 more robust log rotation
This commit is contained in:
@@ -182,9 +182,9 @@ sub rotate_logs {
|
||||
return unless (-f $log_file) and
|
||||
((-s $log_file) > ($logsize * 1024768));
|
||||
|
||||
my @files = glob file($log_dir, '*');
|
||||
foreach my $f (reverse sort @files) {
|
||||
next unless $f =~ m/$log_file\.(\d)$/;
|
||||
my @files = grep { /$log_file\.\d+/ } glob file($log_dir, '*');
|
||||
foreach my $f (sort { $b <=> $a } @files) {
|
||||
next unless $f =~ m/$log_file\.(\d+)$/;
|
||||
my $pos = $1;
|
||||
unlink $f if $pos == ($logfiles - 1);
|
||||
my $next = $pos + 1;
|
||||
|
||||
Reference in New Issue
Block a user