Hi Guys,

I have currently running Zimbra 8.0.2 on Ubuntu 12.04 and I have a question about Zimbra and Linux Bash Scripting.

I currently have a script that is running every day to report mailbox statistics. e.g. account quota usage, Account status & at the end I wanted to total up the statistics.
As you can see I added a TOTAL varibale to add how many accounts there are in the example.com domain.
The problem I now have is I want to total up the domains quota usage but the zmprov gms command writes as a string.

If anyone has any ideas it would be very helpful.

Thanks,
Carl

Code:
#!/bin/bash

/opt/zimbra/bin/zmprov -l gaa example.com | while read ACCOUNT


do
QUOTA=`/opt/zimbra/bin/zmprov ga ${ACCOUNT} | grep "zimbraMailQuota" | awk -F\: '{ print $2}'`
QUOTA=`expr ${QUOTA} / 1024`
QUOTA=`expr ${QUOTA} / 1024`
QUOTA="${QUOTA}MB"
USAGE=` /opt/zimbra/bin/zmmailbox -z -m ${ACCOUNT} gms`
AS=` /opt/zimbra/bin/zmprov ga ${ACCOUNT} | grep zimbraAccountStatus |awk -F\: '{ print $2}'`
NAME=` /opt/zimbra/bin/zmprov ga ${ACCOUNT} | grep uid |awk -F\: '{ print $2}'`
TOTAL=$((TOTAL+1))

echo "Name = ${NAME}">>/tmp/report`date +%d%m%y`.xls
echo "Email Address = ${ACCOUNT}">>/tmp/report`date +%d%m%y`.xls
echo "Quota Usage = ${USAGE} OF ${QUOTA}">>/tmp/report`date +%d%m%y`.xls
echo "Account Status = ${AS}">>/tmp/report`date +%d%m%y`.xls
echo "***************************">>/tmp/report`date +%d%m%y`.xls
echo "Total - $(TOTAL)">>/tmp/report`date +%d%m%y`.xls
echo "***************************">>/tmp/report`date +%d%m%y`.xls

done