Huu Phan | Blog Linux operating system | Linux operating system -Blog Huu Phan | www.huuphan.com
huuphan.com. Powered by Blogger.

Explore the world of seamless email management with Zimbra Mail on Linux! Our blog delves into a step-by-step guide on harnessing the potential of Linux commands, providing easy-to-follow how-tos, and unlocking the magic of Bash scripting. Simplify your email administration journey and enhance your skills with our insightful tips and tricks.

How to backup and restore for zimbra mailbox

In this tutorial, How to "Backup and restore for zimbra mailbox". How to backup mailbox for accounts? How to restore mailbox for accounts?
How to backup and restore for zimbra mailbox





The format list_account file as below:
[email protected]
[email protected]
The script backup mailbox for all accounts
#!/bin/bash
FILE=/tmp/list_account
DATE=$(date +"%a")
ZMBOX=/opt/zimbra/bin/zmmailbox
while read account
do
     echo "---Generating files from backup $account ---"

     $ZMBOX -z -m $account -t 0 getRestURL "//?fmt=zip" > /tmp/$acount.$DATE.zip

done < $FILE
The script restore mailbox for all accounts
#!/bin/bash
FILE=/tmp/list_account
DATE=$(date +"%a")
ZMBOX=/opt/zimbra/bin/zmmailbox
while read account
do
    echo "---Restoring files from backup $account---"
    $ZMBOX -z -m $account -t 0 postRestURL "//?fmt=zip&resolve=reset" /tmp/$account.$DATE.zip
done < $FILE
Note: if you setup multi-server Zimbra with multi-domain, How to backup and restore without split DNS? :)

post new :

Huu Phan | Blog Linux operating system | Huu Phan ~ Zimbra Mail Server,linux,bash script,centos,linux command | www.huuphan.com

This Blog is protected by DMCA.com