The Zimbra server must have the Bacula client installed and configured, and the following script must be on the same machine. The script lists all Zimbra email boxes (zmprov -l gaa) and backs up each of them directly to Bacula through the bpipe plugin.
The process is automatic when restoring the mailbox. Messages, calendar events, and all other user items are automatically restored to Zimbra. Existing similar items are not overwritten (skip).
The script foresees Incremental levels (last 2 days of modifications in the boxes); Differential (last 7 days); and Full (the whole box). You can modify these values in the script itself.
The automatic restore requires some disk space on the Zimbra server because of a postRestURL command limitation that does not allow data to be read directly from the FIFO.
#!/bin/bash #!/bin/bash # # Autoria: Heitor Faria (Copyleft: all rights reversed). # Testado por: xxxx # # Deve ser chamado no sub-recurso INCLUDE do FileSet do bacula-dir.conf, referente ao backup do cliente instalado na máquina do Zimbra (por exemplo): # # Plugin = "\|/etc/bacula/bpipe_zimbra.sh %l" # level=$1 if [ $level == Incremental ] then query="&start=-2days" fi if [ $level == Differential ] then query="&start=-7days" fi zimbra_command="/opt/zimbra/bin/zmmailbox -z -m" for zimbra_user in $(/opt/zimbra/bin/zmprov -l gaa); do echo "bpipe:/var/$zimbra_user.tar:$zimbra_command $zimbra_user -t 0 getRestURL '/?fmt=tar$query':dd of=/tmp/$zimbra_user.tar && $zimbra_command $zimbra_user -t 0 postRestURL -i '//?fmt=tar&resolve=skip' /tmp/$zimbra_user.tar" done
Screenshots
Disponível em: Português (Portuguese (Brazil))EnglishEspañol (Spanish)
A bit rough. The fileset is even missing the level argument.
It should show *all* config elements involved.
It should show a completed backup and a completed restore.
If I may say, you have unique content, much better than many other sources, but please test your examples.
Hello Dark,
The level is the %l (Bacula character substitution):
/etc/bacula/bpipe_zimbra.sh %l
Regards,
Hey 😉
I found that too, it was in the code. But please fix the examples if you can.
I’m still trying to make the restore work and it’s really hard with the missing info
(you’re a genius for figuring all that out yourself)