Date: Fri, 15 Sep 2000 10:49:19 -0600 (MDT) From: "Forrest W. Christian" <forrestc@imach.com> To: Matt Goward <mgoward@eviloverlord.org> Cc: freebsd-isp@FreeBSD.ORG Subject: Re: Mail box trimming tool Message-ID: <Pine.BSF.4.21.0009151039250.19616-100000@workhorse.iMach.com> In-Reply-To: <200009151707.NAA32297@eviloverlord.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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 (<INPUT>)
{
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 <mgoward@eviloverlord.org>
> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0009151039250.19616-100000>
