procmail
[Top] [All Lists]

Re: Limit mailbox size

2003-06-26 09:11:35
On Thu, Jun 26, 2003 at 10:00:59AM -0300, Gerardo Herzig wrote:

QUOTA=`ls -l /var/spool/mail/$LOGNAME | awk -F"  *" {'print 15000000 - $5'}` 

Urk.

Have a look at http://www.it.ca/software/fsizecompare.c .  You could:

  :0
  * ! LOGNAME ?? ^^(root|gherzig)^^
  * ! ? test -f $HOME/.noquota
  * ? fsizecompare 15000000 /var/mail/$LOGNAME
  | (
    # generate bounce notice
  )

In the first condition, hard-coded exemptions are faster inside
procmail.  In the second, you have an optional exemption if the file
exists.  And if you haven't stopped checking things yet, you do the size
check and generate the bounce.

Why do it this way?  If you process lots of mail, you want tools that
will have a smaller impact on your server.

On my system:

# ls -l `which ls awk`
-r-xr-xr-x  1 root  wheel  339304 May 15 15:38 /bin/ls
-r-xr-xr-x  1 root  wheel  160368 May 15 15:39 /usr/bin/awk

versus:

# ls -l `which fsizecompare test`
-r-xr-xr-x  2 root  wheel   64208 May 15 15:39 /bin/test
-rwxr-xr-x  1 root  wheel    3524 Dec  2  2001 /root/bin/fsizecompare

-- 
  Paul Chvostek                                             
<paul(_at_)it(_dot_)ca>
  Operations / Abuse / Whatever
  it.canada, hosting and development                   http://www.it.ca/


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>