From owner-freebsd-isp Sun Sep 17 23:56: 8 2000 Delivered-To: freebsd-isp@freebsd.org Received: from dell.dannyland.org (dell.dannyland.org [64.81.36.13]) by hub.freebsd.org (Postfix) with ESMTP id 03E5B37B424 for ; Sun, 17 Sep 2000 23:56:05 -0700 (PDT) Received: by dell.dannyland.org (Postfix, from userid 1001) id 91BC05BEB; Sun, 17 Sep 2000 23:54:44 -0700 (PDT) Date: Sun, 17 Sep 2000 23:54:44 -0700 From: dannyman To: David Drum Cc: freebsd-isp@freebsd.org Subject: Re: Mail box trimming tool Message-ID: <20000917235444.A30479@dell.dannyland.org> References: <200009151707.NAA32297@eviloverlord.org> <20000917174029.A94914@elvis.mu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i In-Reply-To: <20000917174029.A94914@elvis.mu.org>; from david@mu.org on Sun, Sep 17, 2000 at 05:40:29PM -0500 X-Loop: djhoward@uiuc.edu X-URL: http://www.dannyland.org/~dannyman/ Sender: owner-freebsd-isp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Sun, Sep 17, 2000 at 05:40:29PM -0500, David Drum wrote: > Quoth Matt Goward: > > > Does anyone know of a tool that given a username and quota, will trim a > > mail box by deleting the oldest message until it is at the quota? > > Based on some statistics I generated for the 60,000-plus mailboxes I > am responsible for, the median size is usually very small (under 1KB) > but the standard deviation is very large (around 1.5MB). So I don't know > that expiring based on a space quota is appropriate, since mailbox sizes > vary greatly. We expire messages that are over 14 days old (based on > the headers). I've attached the script we use. I have a web site that harvests pictures off of USENET a a constant rate. Since I have finite storagespace, I of course have an expire script. It deletes files that are the oldest, with the catch that I subtract the file size from the seconds since epoch. a 1M file would be deleted about 10 days before a 100k file, for example. (if my math is right.) An algorithm like this is trivial to implement if your mail storage is Maildir, is why I think of it. Even so, if you're going through the pain of parsing mbox, it's a pretty simple sort of calculation to make. Of course, it might be truly clever to replace a large MIME attachment with a note saying it has been triaged out to save your quota, rather than deleting a message, but I digress. :) -d -- dannyman - http://www.dannyland.org/~dannyman/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-isp" in the body of the message