4 # (c) 2001--2002 Martin Mares <mj@ucw.cz>
8 @ARGV >= 3 or die "Usage: rotate-log <days-to-compress> <date-to-delete> <logs...>";
14 $compress_thr = $now - 86400 * $cps;
15 $delete_thr = $now - 86400 * $del;
18 $st = stat $f or next;
19 if ($del > 0 && $st->mtime < $delete_thr) {
20 print "Deleting $f\n";
21 unlink $f || die "Delete FAILED: $!";
22 } elsif ($cps > 0 && $st->mtime < $compress_thr && $f !~ /\.(gz|bz2)$/) {
23 print "Compressing $f\n";
25 $? && die "Compression FAILED: $!";