zimbra

Execute all below commands as zimbra user

To check status of all zimbra services

zmcontrol status

List all domains on zimbra

zmprov -l gad

List all zimbra user accounts

zmprov -l gaa | sort

Get ID of all zimbra accounts

for i in $( zmprov -l gaa ); do echo $i $( zmprov gmi $i | grep mailboxId ); done

Export full backup of one zimbra account

zmmailbox -z -m user@domain -t 0 getRestURL "//?fmt=tgz" > /tmp/user@domain.tgz

Export current day backup of one zimbra account*

zmmailbox -z -m user@domain -t 0 getRestURL --startTime $(date -d '-1 day' +%Y/%m/%d) --endTime $(date -d '+1 day' +%Y/%m/%d) "//?fmt=tgz" > /tmp/user@domian.tgz

Export last 7 days backup of one zimbra account*

zmmailbox -z -m user@domain -t 0 getRestURL --startTime $(date -d '-8 day' +%Y/%m/%d) --endTime $(date -d '+1 day' +%Y/%m/%d) "//?fmt=tgz" > /tmp/user@domain.tgz

Export current month backup of one zimbra account*

zmmailbox -z -m user@domain -t 0 getRestURL --startTime $(date -d "-$(date +%d) days -0 month" +%Y/%m/%d) --endTime $(date -d "-$(date +%d) days +1 month +1 day" +%Y/%m/%d) "//?fmt=tgz" > /tmp/user@domain.tgz

Export previous month backup of one zimbra account*

zmmailbox -z -m user@domain -t 0 getRestURL --startTime $(date -d "-$(date +%d) days -1 month" +%Y/%m/%d) --endTime $(date -d "-$(date +%d) days -0 month +1 day" +%Y/%m/%d) "//?fmt=tgz" > /tmp/user@domain.tgz

Import zimbra backup of one account

zmmailbox -z -m user@domain -t 0 postRestURL "//?fmt=tgz&resolve=skip" /tmp/user@domain.tgz

*Set more 1 day on the start and end date because it is not possible to specify the time on the dates

The resolve=paramater has several options:
“skip” ignores duplicates of old items, it’s also the default conflict-resolution
“reset” will delete the old subfolder (or entire mailbox if /)
“modify” changes old items
“replace” will delete and re-enter them

See the size of all zimbra mailbox accounts

for i in $( zmprov -l gaa ); do echo Mailbox size $i = $( zmmailbox -z -m $i gms ); done

Reindex zimbra user account

zmprov rim user@domain start

See status of reindex zimbra user account

zmprov rim user@domain status

Fix zimbra permissions (execute as root)

/opt/zimbra/libexec/zmfixperms --verbose --extended

Check integrity mysql database

/opt/zimbra/libexec/zmdbintegrityreport -m -v

View quota usage in MB of all zimbra accounts

zmprov gqu serverNameHere | sort | awk '{printf "%s %d/%d mb\n", $1, $3/1024/1024, $2/1024/1024}'

See the last 15 mails from user

zmmailbox -z -m user@domain s -t message -l 15 "in:inbox"

Export LDAP configuration zimbra

/opt/zimbra/openldap/sbin/slapcat -F /opt/zimbra/data/ldap/config -b "" -l /tmp/zimbra-ldap.ldif

Zimbra Logs

tail -f /var/log/zimbra.log
tail -f /opt/zimbra/log/mailbox.log
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s