backup mailbox zimbra open source

In Zimbra open source edition we have to use custom scripts to make a backup of our mailboxes.

su – zimbra

Make a single mailbox backup

zmmailbox -z -m bentoslack@bentoslack.com getRestURL "//?fmt=tgz" > /home/Backup/bentoslack_bentoslack_com.tar.gz

restore from backup

zmmailbox -z -m bentoslack@bentoslack.com postRestURL "//?fmt=tgz&resolve=reset" /home/Backup/bentoslack_bentoslack_com.tar.gz

Script to backup all mailboxes

ZHOME=/opt/zimbra
ZBACKUP=/tmp/backup/mailbox
ZCONFD=$ZHOME/conf
DATE=`date +"%a"`
ZDUMPDIR=$ZBACKUP/$DATE
ZMBOX=/opt/zimbra/bin/zmmailbox
if [ ! -d $ZDUMPDIR ]; then
mkdir -p $ZDUMPDIR
fi
echo " Running zmprov ... "
for mbox in `zmprov -l gaa`
do
echo " Generating files from backup $mbox ..."
$ZMBOX -z -m $mbox getRestURL "//?fmt=zip" > $ZDUMPDIR/$mbox.zip
done

Script to restore mailboxes from backup

#!/bin/bash
ZHOME=/opt/zimbra
ZBACKUP=/tmp/backup/mailbox
ZCONFD=$ZHOME/conf
DATE=`date +"%a"`
ZDUMPDIR=$ZBACKUP/$DATE
ZMBOX=/opt/zimbra/bin/zmmailbox
if [ ! -d $ZDUMPDIR ]; then
echo "Backups do not exist !"
exit 255;
fi
for mbox in `zmprov -l gaa`
do
echo " Restoring files from backup $mbox ..."
$ZMBOX -z -m $mbox postRestURL "//?fmt=zip&resolve=reset" $ZDUMPDIR/$mbox.zip
done

You can customize the scripts in way which you want , source .

1 thought on “backup mailbox zimbra open source

  1. Pingback: upgrade zimbra from 8.0.4 to 8.0.5 | IT tech blog

Leave a Reply

Your email address will not be published. Required fields are marked *