our ($spooldir,@logdir,$docdir);
our ($akeydir,$ukeydir,$dkeydir,$skeydir,$gkeydir,$xkeydir,$lockdir);
our ($durl,$debug,$autodelete,$hostname,$admin,$admin_pw,$bcc);
-$keep_default = 5;
+our $keep_default = 5;
+our $purge = $keep_default*3;
# load common code, local config : $HOME/lib/fex.ph
require "$FEXLIB/fex.pp" or die "$0: cannot load $FEXLIB/fex.pp - $!\n";
sub cleanup {
my ($to,$from,$file) = @_;
my ($data,$download,$notify,$mtime,$warn,$dir,$filename,$dkey,$delay);
- my $comment = '';
my $keep = $keep_default;
+ my $purge = $::purge || 3*$keep;
+ my $comment = '';
my $kf = "$to/$from/$file/keep";
my $ef = "$to/$from/$file/error";
local $_;
logdel($file,"$file deleted");
}
} elsif ($mtime = lmtime("$file/error")) {
- if ($today > 3*$keep*DS+$mtime) {
- verbose("rmrf $file (today=$today mtime_error=$mtime keep=$keep)");
+ $purge = $1*$keep if $purge =~ /(\d+).*keep/;
+ if ($today > $purge*DS+$mtime) {
+ verbose("rmrf $file (today=$today mtime_error=$mtime keep=$keep purge=$purge)");
logdel($file,"$file deleted");
}
} else {