From owner-freebsd-isp Fri Sep 15 10:47: 1 2000 Delivered-To: freebsd-isp@freebsd.org Received: from workhorse.iMach.com (workhorse.iMach.com [206.127.77.89]) by hub.freebsd.org (Postfix) with ESMTP id 08F3F37B422 for ; Fri, 15 Sep 2000 10:46:54 -0700 (PDT) Received: from localhost (forrestc@localhost) by workhorse.iMach.com (8.9.3/8.9.3) with ESMTP id KAA20255; Fri, 15 Sep 2000 10:49:19 -0600 (MDT) Date: Fri, 15 Sep 2000 10:49:19 -0600 (MDT) From: "Forrest W. Christian" To: Matt Goward Cc: freebsd-isp@FreeBSD.ORG Subject: Re: Mail box trimming tool In-Reply-To: <200009151707.NAA32297@eviloverlord.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-isp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Yep Perl. Some assembly required. Something like: (Pseudocode) Actual working code is left as an exercise to the reader.. stat (mailspool) if (length>quota) { open OUTPUT "temporaryfile" open INPUT "mailspool" fseek INPUT, length-quota; $foundheading=0; $lastwasblank=0; while () { chomp; if ($foundheading) { print OUTPUT $_; } elsif (($lastwasblank)&&(/^From /)) { print OUTPUT $_; $foundheading=1; } elsif (/^$/) { $lastwasblank=1 } else { $lastwasblank=0; } } close INPUT; close OUTPUT; rename "mailspool","mailspool.old" or die "could not rename: $!"; rename "temporaryfile","mailspool" or die " could not rename: $!"; unlink "mailspool.old"; } } (if you'd like to pay me to make this actually work, let me know :) On Fri, 15 Sep 2000, Matt Goward wrote: > Date: Fri, 15 Sep 2000 13:07:08 -0400 > From: Matt Goward > To: freebsd-isp@FreeBSD.ORG > Subject: Mail box trimming tool > > 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? > > Thank you in advance, > Matt Goward > eviloverlord.org > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-isp" in the body of the message > - Forrest W. Christian (forrestc@imach.com) AC7DE ---------------------------------------------------------------------- iMach, Ltd., P.O. Box 5749, Helena, MT 59604 http://www.imach.com Solutions for your high-tech problems. (406)-442-6648 ---------------------------------------------------------------------- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-isp" in the body of the message