Showing posts from May, 2013

Script to count quota usage using postfixadmin and maildir (postfix vda)

xoxoxoxoxoxo The script begin here: xoxoxoxoxoxo
echo "updating quota2"

#change to maildir folder
cd /home/vmail/

#write in one line
du -s * | awk '{ print "insert into quota2 values (\"" $2 "\"," $1 "*1000,1000) on duplicate key update bytes=" $1 "*1000;" }' | mysql -uroot -pyourpassword postfixadmin

echo "done"

xoxoxoxoxoxo end of scriptxoxoxoxoxoxo

Put the script in crontab, run as often as you wish.

Modify /etc/postfixadmin/

$CONF['domain_path'] = 'YES';
$CONF['domain_in_mailbox'] = 'YES';
$CONF['used_quotas'] = 'YES';
$CONF['new_quota_table'] = 'YES';