davromaniak / zimbashckup

ZimBashckup : Zimbra Backup Script in Bash
GNU General Public License v2.0
35 stars 17 forks source link

zimbashckup

ZimBashckup : Zimbra Backup Script in Bash

About

Simple Bash script for backing up zimbra mailboxes.
Inspired by the script zimbraBackupAllAccounts.sh written by Richardson Lima and available here : http://wiki.zimbra.com/wiki/Backing_up_and_restoring_Zimbra_%28Open_Source_Version%29#Another_option
I modified Richardson's script for personal needs, and I think it could help people, so I decided to redistribute it.

Requirements

Installation

Default behavior

Argument/options list

Examples

Backup mailboxes from domain "domain1.tld" using the tgz format and using one file per mailbox : zimbashckup.sh --domains="domain1.tld" --format=tgz --unite

Backup only mailboxes user1@domain1.tld and user1@domain2.tld with one file by folder using format zip : zimbashckup.sh --mailboxes="user1@domain1.tld user1@domain2.tld" --format=zip

Backup all mailboxes one file by folder using format tgz, use the locale "fr_FR.UTF-8", keep 5 days of backups and put them in /var/backups/zimbra : zimbashckup.sh --format=tgz --locale="fr_FR.UTF-8" --keep=5 --dest="/var/backups/zimbra"

Restoring Backups

For now, Zimbashckup doesn't do mailbox restore.

For the restore process, it has to be performed with the zmmailbox tool (http://wiki.zimbra.com/wiki/Zmmailbox) with the postRestURL command.

Something like /opt/zimbra/bin/zmmailbox -z -m user@domain.com -t 0 postRestURL "//?fmt=tgz&resolve=reset" account.tgz should work, but be carefull (mostly with the resolve parameter, when set to "reset", it will empty the destination mailbox and replace it with the TGZ dump.

If you can work with a test zimbra, don't hesitate to test it, I've done a lot of mistakes when testing.

License

Zimbashckup is distributed under the terms of the GNU General Public
License as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. A copy of this
license can be found in the file LICENSE included with the program.

Ideas, questions, patches and bug reports

Send me a mail, and I will answer you, :).

-- 2013-2014 by Cyril Lavier bainisteoir(at)davromaniak(dot)eu