No mailbox.tgz in incremental tar files
Closed this issue · 1 comments
Hi,
I have an issue with rewrite_proposal_2.0 of Zmbkpose.
This issue was mentioned in issue #33 by ymarinov but it was not answered as far as I can see.
When incremental files are created, if there are no new mails, calendar or any other entries for the specific user, there will be no mailbox.tgz file in the :INC.tar file. This is not an error per se, but when you try to restore that specific user, an error is thrown and the restore stops. The error is in the form:
ERROR: file mailbox.tgz does not exists in tar file "/opt/zimbra/backup/user1.mail@mydomain.com/20140222215236:INC.tar"
NOTE: I changed the domain to mydomain.com for privacy purposes.
The error comes from the code in the restore_account() function, namely this part:
#Restore
if ! $TAR_cmd -tf "$tar_bkfile" $MAILBOX_FILE_IN_TAR >/dev/null 2>&1;then
error "file $MAILBOX_FILE_IN_TAR does not exists in tar file \"$tar_bkfile\""
return 1
fi
if [ -z "$SIMULATE" ] ;then
$TAR_cmd -O -xf "$tar_bkfile" $MAILBOX_FILE_IN_TAR| \
zimbra_mailbox_restore "$account" "$mailhost"
fi
I changed this code a little bit so that it doesn't stop on error, but just skip. You could also add the check for the -u switch, although this is not an error, this is just the way the incremental files are created. The changed code looks like this:
#Restore
if ! $TAR_cmd -tf "$tar_bkfile" $MAILBOX_FILE_IN_TAR >/dev/null 2>&1;then
error "file $MAILBOX_FILE_IN_TAR does not exists in tar file \"$tar_bkfile\"
elif [ -z "$SIMULATE" ] ;then
$TAR_cmd -O -xf "$tar_bkfile" $MAILBOX_FILE_IN_TAR| \
zimbra_mailbox_restore "$account" "$mailhost"
fi
I am not that good at bash scripting, so I am sure that this can be improved. Hope this helps someone else.
BTW, this is an excellent project.
Thank you for all your efforts and time and keep up the good work!