Zimbra Snippets

Moving user mailbox between servers in a multi servers installation

The idea for this code cas found there: http://www.zimbra.com/forums/migration/36851-zmmailboxmove-zimbra-6-os.html

zmprov ma $user@$domain zimbraAccountStatus maintenance
zmmailbox -z -m $user@$domain getRestURL "//?fmt=tgz" > /tmp/account.tgz
zmprov ma $user@$domain zimbraMailhost $newServer
zmmailbox -z -m $user@$domain postRestURL "//?fmt=tgz&resolve=reset" /tmp/account.tgz
zmprov ma $user@$domain zimbraAccountStatus maintenance

This operation might last for few minutes if the user mailbox is huge.

Increase/decrease mailbox quota with cli

This is a very basic script for changing quotas, a lot of test and automation can be made. THe script take one argument, the account to modify quota.

actualQuota=`zmprov ga $1 zimbraMailQuota | grep -v "#" |cut -d ":" -f 2 | head -n 1|sed -e 's/ //g'`
let disQuota=$actualQuota/1024/1024
echo "Actual quota: $disQuota"
echo "New Quota?"
read newQuota
echo "$newQuota sur?"
read i
let newQuota=$newQuota*1024*1024
zmprov ma $1 zimbraMailQuota $newQuota

The quota is given in MB


Leave a Reply

(Your email will not be publicly displayed.)