hi everybody,
i have discovered a possible bug in the way qmail-ldap calculate the maildir's size. The problem is in the maildirsize file.

I think that it happens when the maildir have a lot of small messages. Then qmail-ldap always reports that the maildirsize is smaller than the real.

For example, if the maildirsize has 512 files and a size of 110 MB, qmail-ldap thinks that there are less of 100 files and 20 MB of size.


This is a big problem when you have a limited space in disk (50 GB), and a fixed number of mail users (1000) with only 50 MB of  maildirsize ... :(


I have found a program (deliverquota) that comes with courier-imap. It delivers a message to a maildirsize and modify or create the maildirsize in the right way

I thought that if i changed the defaultdelivery of qmail-ldap (/var/qmail/control/defaultdelivery) to someting like that:

| /usr/local/courier-imap/deliverquota ./Maildir/ "50000000S,10000C"

the problem will be resolved, but i was wrong

Finally, my solution is every 5 minutes run this script made by me (sorry, i'm not a programmer):


 #!/bin/sh

## Variables

maildirs=/home/maildirs


## Funciones

function borra_msg () {

aux=`/bin/pwd`

cd $maildirs/$d/Maildir/new

for m in *; do

/bin/grep "19#|vb" $m > /dev/null

        if [ $? -eq 0 ]; then
                /bin/rm $m
        fi

done

cd $aux

}


### MAIN ###


cd $maildirs

for d in *; do

cd $maildirs/$d/Maildir/

/bin/rm maildirsize

        if [ $d == postmaster ]; then

                echo "19#|vb" | /usr/local/courier-imap/bin/deliverquota $maildirs/$d/Maildir "100000000S,10000C"

                if [ $? -eq 0 ]; then
                        borra_msg
                fi

        else echo "19#|vb" | /usr/local/courier-imap/bin/deliverquota $maildirs/$d/Maildir "50000000S,10000C"

                if [ $? -eq 0 ]; then
                        borra_msg

                fi
        fi

/bin/chown vmail.vmail maildirsize

cd ../..


It does his job well. And now i haven't to worry about oversize maildirs :)

Despite this problem, the mail server (qmail-ldap/courier-imap/openldap/etc) goes very well. It is flawless :)))


If helps, this are the program versions (and some main configurations):

Debian GNU/Linux 3.1
qmail-1.0.3-20050401a
courier-imap 4.0.3
openldap-stable-20050429


/service/qmail-send/run:
# --------------------------------------------------------------------------------
#!/bin/sh

DELIVERY=`cat /var/qmail/control/defaultdelivery`

# Please see http://www.nrg4u.com/qmail/QLDAPINSTALL
# to understand the meaning of this variables. Thanks

# LOGLEVEL
# 1 Errors
# 2 Warnings
# 4 Info
# 16 Debug
# 32 Debug
# 64 Ldap debug
# 128 Ldap debug^2
# 256 Debug (Passwd)

export LOGLEVEL=1

#QMAILQUEUE

exec env - PATH="/var/qmail/bin:$PATH" qmail-start "$DELIVERY"
# ----------------------------------------------------------------------------------------------

/var/qmail/control/defaultdelivery:
| /usr/local/courier-imap/bin/deliverquota ./Maildir/

/var/qmail/control/defaultquotaacount:
10000

/var/qmail/control/defaultquotasize:
50000000

The openldap qmailQuotaSize and qmailQuotaCount attributes of the openldap's mail users are respectly 50000000 and 10000

Regards






 




--
"If I ever met Bill Gates, there wouldn't be much of a
meeting point. I couldn't tell him about business, and
he couldn't tell me about technology."
-- Linus Torvalds

Reply via email to