Last active
December 23, 2015 09:49
-
-
Save limed/ace0b0a58490a8d49037 to your computer and use it in GitHub Desktop.
Checks if user is over quota and gives a report
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| IAM=`id -un` | |
| if [ "$IAM" != "zimbra" ]; then | |
| echo "You must run this script as the 'zimbra' user. Please 'su - zimbra' first." | |
| exit 1 | |
| fi | |
| # Run command zmprov gc Phoenix zimbraMailQuota | grep zimbraMailQuota | awk '{print $2}' | |
| default_quota=$(zmprov gc Phoenix zimbraMailQuota | grep zimbraMailQuota | awk '{print $2}') | |
| for i in $(zmprov -l gas | grep mbox); do | |
| zmprov gqu ${i} | while read line; do | |
| user=`echo $line | cut -f1 -d\ ` | |
| quota=`echo $line | cut -f2 -d\ ` | |
| usage=`echo $line | cut -f3 -d\ ` | |
| if [ $usage -gt $default_quota ]; then | |
| echo "User ${user} is over quota: ${usage}" | |
| fi | |
| done | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment