4270f93b |
#!/usr/bin/perl
# ---- Settings ----
# TemporaryDirectory in clamd.conf |
340ed7f3 |
my $TMPDIR='/tmp'; |
4270f93b |
# How long to wait for next part of RFC1341 message (seconds) |
340ed7f3 |
my $cleanup_interval=3600; |
4270f93b |
# ---- End of Settings ----
|
340ed7f3 |
my $partial_dir = "$TMPDIR/clamav-partial"; |
4270f93b |
# if there is no partial directory, nothing to clean up
opendir(DIR, $partial_dir) || exit 0;
|
340ed7f3 |
my $cleanup_threshold = time - $cleanup_interval; |
4270f93b |
while(my $file = readdir(DIR)) {
next unless $file =~ m/^clamav-partial-([0-9]+)_[0-9a-f]{32}-[0-9]+$/;
my $filetime = $1; |
340ed7f3 |
unlink "$partial_dir/$file" unless $filetime > $cleanup_threshold; |
4270f93b |
}
closedir DIR; |