export multiple mailboxes in one tgz file

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
Post Reply
sangamc
Advanced member
Advanced member
Posts: 150
Joined: Sat Sep 13, 2014 12:39 am

export multiple mailboxes in one tgz file

Post by sangamc »

Hi everyone, I am exporting mail from multiple mailboxes for a legal request at work and trying to save them into one tgz file. Below is my working script that creates a single mailbox for every user searched. With 300+ users on the server I am looking for a way to speed up the process by exporting to a single destination so I can convert to outlook PST for the lawyers.

I have tried changing the export line to: >> /path-to-tgz-file
I thought ">>" would append to the existing zip

I get a huge resultant file, but I can not open it to import to zimbra web or desktop. Is there something I am missing with this process?
If anyone has any good pointers that could help, I would greatly appreciate it.

Thanks!

Code: Select all

#!/bin/bash
# rm_message.sh user@domain.com subject
if [ -z "$2" ]; then
echo "usage:  zimbra-search.sh <search string> example.com"
exit 0

else
search=$1
domain=$2
for acct in `zmprov -l gaa "$domain" | grep -E -v '(^admin@|^spam\..*@|^ham\..*@|^virus-quarantine.*@|^galsync.*@)'|sort` ; do
    echo "Searching $acct for $search"
    zmmailbox -z -m "$acct" s -l 999 -t message "$search"
    echo "Now parsing the message id"
    zmmailbox -z -m "$acct" -t 0 getRestURL '//?fmt=tgz&query=content:("$search")' > /opt/migrate/exports/"$acct".tgz
done
fi





CentOS release 6.10 (Final)
Version = Release 8.8.9_GA_3019.RHEL6_64_20180809160254 RHEL6_64 FOSS edition, Patch 8.8.9_P10.
Post Reply