Skip to content

Instantly share code, notes, and snippets.

@limed
Last active December 23, 2015 09:49
Show Gist options
  • Select an option

  • Save limed/ace0b0a58490a8d49037 to your computer and use it in GitHub Desktop.

Select an option

Save limed/ace0b0a58490a8d49037 to your computer and use it in GitHub Desktop.
Checks if user is over quota and gives a report
#!/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