Sunday 20 May 2012

Mailbox size of all accounts


How to check mailbox size of all accounts in Zimbra mail server.


 I would like to check a mailbox size of all users in my Zimbra mail server and I can check these sizes by create a shell script which has 2 commands for query.
     1.    zmprov gaa => I use this command for query all accounts in my Zimbra server.
     2. zmmailbox -z -m your-account gms => Get mailbox size of your-account account

For all user we can use use a bash script.

# su zimbra
#vim zmchkmailsize.sh


#!/bin/sh
WHO=`whoami`
if [ $WHO = "zimbra" ]
then
all_account=`zmprov -l gaa`;
for account in ${all_account}
do
    mb_size=`zmmailbox -z -m ${account} gms`;
        echo "Mailbox size of ${account} = ${mb_size}";
        done
else
echo "Execute this script as user zimbra (\"su - zimbra\")"
fi


:wq
# chmod 755
# ./zmchkmailsize.sh


OUTPUT:

Mailbox size of admin@example.com.com = 15.74 KB

Mailbox size of spam.g1oxhlgg@example.com = 0 B

Mailbox size of ham.hp_pg_h5@iexample.com = 0 B

Mailbox size of virus-quarantine.cs29ig2sm@example.com = 0 B

Mailbox size of xxx.yyy@example.com = 1.70 KB

Mailbox size of xxx.yyy@example.com = 1.29 KB

Mailbox size of xxx.yyy@example.com = 0 B

Mailbox size of xxx.yyy@example.com = 0 B


2 comments:

Paul said...

Thanks for the post! Very helpful! :)

Anonymous said...

yes very helpful

Post a Comment

 
Design by Wordpress Theme | Bloggerized by Free Blogger Templates | coupon codes