Jan 122010
 

This is the Ugly workaround

Postfix master.cf setting

maildrop  unix  -       n       n       -       -       pipe
  flags=ODRhu user=vmail argv=/usr/bin/maildrop -w 90 -d ${recipient} ${user} ${domain}

With this setting maildrop wil warn user if their Maildir reach 90% of quota and send warning to user

The problem is, even if user emptying their maildir, users wil always get warning because quotawarn is still in Maildir

[vchkpw] quotawarn question

#
MAILHOME="/var/data/postfix"
DOMAIN="$2"
USER="$1"

QUOTA=`echo "$MAILDIRQUOTA" | cut -f 1 -d S`
USAGE=`du -sb "$MAILHOME/$DOMAIN/$USER/" | awk '{print $1}'`
PERCENT=`echo "$QUOTA * 90/100" | bc`

if ( "$USAGE" < "$PERCENT" )
{
        `/bin/rm -f "$MAILHOME/$DOMAIN/$USER/quotawarn"`
}

That mean, when user deleting some files in their Mailidr, maildroprc will recalculate user’s Maildir usage

QUOTA=`echo "$MAILDIRQUOTA" | cut -f 1 -d S`

This will obtain user quota

USAGE=`du -sb "$MAILHOME/$DOMAIN/$USER/" | awk '{print $1}'`

This wil resulting summary of user’s Maildir Disk Usage in byte

PERCENT=`echo "$QUOTA * 90/100" | bc`

This wil calculate 90% of user’s real quota

if ( "$USAGE" < "$PERCENT" )
{
        `/bin/rm -f "$MAILHOME/$DOMAIN/$USER/quotawarn"`
}

When $USAGE is lower than 90% of user’s quota:

`/bin/rm -f "$MAILHOME/$DOMAIN/$USER/quotawarn"`

Will be executed

This is work in my system, or am i missing something about quotawarn file?

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.