#1  
Old 1st September 2008, 07:26
jmroth jmroth is offline
ISPConfig Developer
 
Join Date: Sep 2005
Posts: 191
Thanks: 1
Thanked 6 Times in 6 Posts
Default mailbox quota again and again

Hi there,
when using the standard quota script (quota.rc.master) I'm getting in my logs:

Code:
Command output: ==================== QUOTA:     10000000000 INBOXSIZE: web8_admin Bouncing (inbox already full!) )
Suffice to say, no mails are delivered like that.
I guess INBOXSIZE should be a number and not the username. So I believe something is wrongly parsed there.

I'm not that fluent in procmail language so if someone could maybe comment the quota.rc.master file?

Anyway I'm posting my quota.rc which I have always used and which is working fine (for me).
Code:
#!/bin/bash

QUOTA=10000000000 #10GB

GROUP_QUOTA_ENABLED=0
quota -wg | grep -q ": none" || GROUP_QUOTA_ENABLED=1
if [ $GROUP_QUOTA_ENABLED -eq 1 ]; then
        FS_GROUP_QUOTA=`quota -wg | tail -1 | awk '{print $3}'`*1024
        FS_GROUP_QUOTA=$(($FS_GROUP_QUOTA))
        FS_GROUP_QUOTA_USED=`quota -wg | tail -1 | awk '{print $2}' | sed -n 's/
^\([0-9]*\).*$/\1/g p'`*1024
        FS_GROUP_QUOTA_USED=$(($FS_GROUP_QUOTA_USED))
        FS_GROUP_QUOTA_FREE=$(($FS_GROUP_QUOTA-$FS_GROUP_QUOTA_USED))
else
        FS_GROUP_QUOTA=0
fi

USER_QUOTA_ENABLED=0
quota -wu | grep -q ": none" || USER_QUOTA_ENABLED=1
if [ $USER_QUOTA_ENABLED -eq 1 ]; then
        FS_USER_QUOTA=`quota -wu | tail -1 | awk '{print $3}'`*1024
        FS_USER_QUOTA=$(($FS_USER_QUOTA))
        FS_USER_QUOTA_USED=`quota -wu | tail -1 | awk '{print $2}' | sed -n 's/^
\([0-9]*\).*$/\1/g p'`*1024
        FS_USER_QUOTA_USED=$(($FS_USER_QUOTA_USED))
        FS_USER_QUOTA_FREE=$(($FS_USER_QUOTA-$FS_USER_QUOTA_USED))
else
        FS_USER_QUOTA=0
fi

if [ $FS_USER_QUOTA == 0 ]; then
        if [ $FS_GROUP_QUOTA != 0 ]; then
        # we have unlimtied user filesystem quota but the group is limited
                if [ $FS_GROUP_QUOTA_FREE -lt $QUOTA ]; then
                        QUOTA=$FS_GROUP_QUOTA_FREE
                else
                        QUOTA=$QUOTA
                fi
        else
        # unlimited user and group quota
                QUOTA=$QUOTA
        fi
else
        # both quotas are enabled
        # the minimum of user and group quotas counts
        if [ $FS_GROUP_QUOTA != 0 ]; then
                if [ $FS_USER_QUOTA_FREE -lt $FS_GROUP_QUOTA_FREE ]; then
                        QUOTA=$FS_USER_QUOTA_FREE
                else
                        QUOTA=$FS_GROUP_QUOTA_FREE
                fi
        # user quota is enabled and group quota is disabled
        else
                if [ $FS_USER_QUOTA_FREE -gt 0 ]; then
                        QUOTA=$FS_USER_QUOTA_FREE
                else
                        QUOTA=0
                fi
        fi
fi

echo $QUOTA
EDIT Actually, I am calling the above code from quota.rc like so:
Code:
# quota.rc by Stuart Clark/Falko Timme
#
# If mailbox size exceeds QUOTA, send reply email
# using $PMDIR/bounce-exceed-quota.txt
##
# If incoming message size exceeds available storage
# space (user/group filesystem quota) then
# send reply email using bounce-exceed-quota.txt
#
#LOGFILE="/tmp/procmail.quota.$LOGNAME.log"
#VERBOSE=YES
DROPPRIVS=YES

## using repquota will not work because normal users must not use it
PATH="/usr/bin:$PATH:/usr/local/bin"
SHELL=/bin/sh
EMAIL=`formail -zxTo:`

QUOTA=`iipmailquotacheck.sh`
:0
* > ${QUOTA}
{
        LOG="*** The disk space of this user or domain has been exceeded. Please
 try again at a later time. ***"
        EXITCODE=69
        HOST
}
#end

Last edited by jmroth; 1st September 2008 at 07:29.
Reply With Quote
Sponsored Links
  #2  
Old 1st September 2008, 09:41
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,990
Thanks: 825
Thanked 5,373 Times in 4,220 Posts
Default

Do you use mailfir or mbox?
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #3  
Old 1st September 2008, 09:43
jmroth jmroth is offline
ISPConfig Developer
 
Join Date: Sep 2005
Posts: 191
Thanks: 1
Thanked 6 Times in 6 Posts
Default

I'm using Maildir
Reply With Quote
  #4  
Old 1st September 2008, 09:45
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 35,990
Thanks: 825
Thanked 5,373 Times in 4,220 Posts
Default

In case of maildir this recipe is not needed. Please make a copy of the procmailrc.master file and copy it to the customized_templates folder. In this file, remove the line that includes the quota recipe. Then edit the affected account in ISPConfig and click on save so that the config file is updated.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #5  
Old 1st September 2008, 09:53
jmroth jmroth is offline
ISPConfig Developer
 
Join Date: Sep 2005
Posts: 191
Thanks: 1
Thanked 6 Times in 6 Posts
 
Default

Yeah I think I remember now ;-)

Nevertheless, one could simply disable this, since the system should know whether to use mailboxes or maildirs (set in Management -> Server Settings)

Also, I used my custom solution because I found the standard message that the user is over quota is not understood by the average user to whom mail might be returned.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 14:26.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.