Show Closed accounts with their Quota and Used Space

Revision as of 09:22, 20 April 2015 by Jorge de la Cruz (talk | contribs) (Created page with "{{WIP}}{{Article Infobox|{{admin}}|{{ZCS 8.6}}|{{ZCS 8.5}}|{{ZCS 8.0}}}} =Show Closed accounts with their Quota and Used Space= ==Purpose== This simple Script lists out all th...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Admin Article

Article Information

This article applies to the following ZCS versions.

ZCS 8.6 Article ZCS 8.6ZCS 8.5 Article ZCS 8.5ZCS 8.0 Article ZCS 8.0


Show Closed accounts with their Quota and Used Space

Purpose

This simple Script lists out all the Closed accounts and what their quota is and what is used and the last time it was accessed, and what server the mail was hosted on.

Resolution

First step is create the Script file, in this example will be under the /tmp folder, but choose the path that you prefer.

cd /tmp vi closed-accounts.sh

Paste then inside the next code

#!/bin/bash
echo "Username Total Quota Usage Server Last Login Time"
zmaccts | grep closed | grep @ | awk '{ print $1 }' | while read ACCOUNT
do
QUOTA_TOTAL=`zmprov ga ${ACCOUNT} | grep "zimbraMailQuota" | cut -d ":" -f2`
QUOTA_USAGE=`zmmailbox -z -m ${ACCOUNT} gms`
HOSTED_ON=`zmprov ga ${ACCOUNT} | grep zimbraMailHost | awk -F: '{ print $2 }'`
LAST_ON=`zmprov ga ${ACCOUNT} | grep zimbraLastLogonTimestamp: | awk -F: '{ print $2 }' `
echo "${ACCOUNT} ${QUOTA_TOTAL} ${QUOTA_USAGE} ${HOSTED_ON} ${LAST_ON} "
done

Then make it executable

chmod +x

Now can execute the script and will look like

zimbra@zimbra-sn-u14-10:/tmp$ ./script.sh
Username Total Quota Usage Server Last Login Time
user@example.com  524288000 13.13 MB  mail.example.com  20141127210335Z

Additional Content

  • Not related content


Verified Against: Zimbra Collaboration 8.6, 8.5, 8.0 Date Created: 03/19/2015
Article ID: https://wiki.zimbra.com/index.php?title=Show_Closed_accounts_with_their_Quota_and_Used_Space Date Modified: 2015-04-20



Try Zimbra

Try Zimbra Collaboration with a 60-day free trial.
Get it now »

Want to get involved?

You can contribute in the Community, Wiki, Code, or development of Zimlets.
Find out more. »

Looking for a Video?

Visit our YouTube channel to get the latest webinars, technology news, product overviews, and so much more.
Go to the YouTube channel »


Wiki/KB reviewed by Jorge SME 2 Copyeditor Last edit by Jorge de la Cruz
Jump to: navigation, search