[Mimedefang] URGENT:/var filling up

Smith, Kevin C kevin.smith at nmci-isf.com
Thu Jun 27 13:53:07 EDT 2002

Thanks, that should solve it.
You saved me.


-----Original Message-----
From: Jason Englander [mailto:jason at englanders.cc]
Sent: Thursday, June 27, 2002 10:43
To: mimedefang at lists.roaringpenguin.com
Subject: RE: [Mimedefang] URGENT:/var filling up

On Thu, 27 Jun 2002, Barry Byrne wrote:

> Kevin:
> I run a cron job once a day to clear out quarantined files:

Me too. Here's mine in perl.

#!/usr/bin/perl -w

# 604800 seconds = 1 week
my $killifolderthan = 604800;
my $mdqueuedir = '/var/spool/MIMEDefang';

use strict;

my @mdqueuedirs=readdir(MDQUEUEDIR);
foreach my $qdir (@mdqueuedirs) {
	next if $qdir eq '.' || $qdir eq '..';
	my @dir_info=stat("$mdqueuedir/$qdir");
	my $mtime=$dir_info[9];
	my $now=time;
	my $age=$now - $mtime;
	&killdir("$mdqueuedir/$qdir") if $age >= $killifolderthan;

sub killdir {
	my $dir2kill = $_[0];
	my @filesindir2kill = readdir(DIR2KILL);
	#print "Removing $dir2kill and the files in it:\n";
	foreach my $file (@filesindir2kill) {
		next if $file eq '.' || $file eq '..' || ! -f
		unlink("$dir2kill/$file") || die "\nUnable to delete
$dir2kill/$file: $!\n\n";
		#print "  $file\n";
	rmdir("$dir2kill") || die "\nUnable to remove $dir2kill:
	print "Removed $dir2kill\n";

Jason Englander
jason at englanders.cc

MIMEDefang mailing list
MIMEDefang at lists.roaringpenguin.com

More information about the MIMEDefang mailing list