Old Server:
Code: Select all
$ zmmailbox -z -m hashir@domain.com getRestURL 'Calendar/?fmt=tgz' > /tmp/hashir-calendar.tgz
$ zmmailbox -z -m hashir@domain.com getRestURL 'Contacts/?fmt=tgz' > /tmp/hashir-contacts.tgz
$ zmmailbox -z -m hashir@domain.com getRestURL 'Tasks/?fmt=tgz' > /tmp/hashir-tasks.tgz
$ zmmailbox -z -m hashir@domain.com getRestURL 'Emailed Contacts/?fmt=tgz' > /tmp/hashir-emailcontacts.tgz
Code: Select all
# scp /tmp/hashir-calendar.tgz /tmp/hashir-contacts.tgz /tmp/hashir-tasks.tgz /tmp/hashir-emailcontacts.tgz root@<new_server_ip>:/tmp/
New Server:
Code: Select all
# chown zimbra:zimbra /tmp/hashir-calendar.tgz /tmp/hashir-contacts.tgz /tmp/hashir-emailcontacts.tgz /tmp/hashir-tasks.tgz
# su - zimbra
$ zmmailbox -z -m hashir@domain.com postRestURL "//?fmt=tgz&resolve=skip" /tmp/hashir-calendar.tgz
$ zmmailbox -z -m hashir@domain.com postRestURL "//?fmt=tgz&resolve=skip" /tmp/hashir-contacts.tgz
$ zmmailbox -z -m hashir@domain.com postRestURL "//?fmt=tgz&resolve=skip" /tmp/hashir-emailcontacts.tgz
$ zmmailbox -z -m hashir@domain.com postRestURL "//?fmt=tgz&resolve=skip" /tmp/hashir-tasks.tgz
Code: Select all
$ zmmailbox -z -m hashir@domain.com gaf | grep Calendar
$ zmmailbox -z -m hashir@domain.com ef /Calendar
$ zmmailbox -z -m hashir@domain.com ef /Emailed\ Contacts
Bulk Users Export:
Old Server:
Create a folder for exports:
Code: Select all
# mkdir /tmp/all-users_calendars
Code: Select all
$ for accts in $(zmprov -l gaa | grep -Ev "^(galsync|spam|ham|virus)"); do echo "Exporting account $accts"; zmmailbox -z -m $accts getRestURL 'Calendar/?fmt=tgz' > /tmp/all-users_calendars/$accts.tgz && echo "$accts Exported"
done
Code: Select all
# mkdir /tmp/users_calendars
# find /tmp/ -name "*.tgz" -size +0k -exec cp {} users_calendars/ \;
Code: Select all
# ls /tmp/all-users_calendars/ | sed 's/.tgz//g' >> all_calenders_accounts.txt
Code: Select all
# scp -rv /tmp/users_calendars /tmp/all_calenders_accounts.txt root@<new_server_ip>:/tmp/
New Server:
Set correct permissions:
Code: Select all
# chown -R zimbra:zimbra /tmp/users_calendars
# chown zimbra:zimbra /tmp/all_calenders_accounts.txt
Import all user calendars:
Code: Select all
$ for accts in $(cat /tmp/all_calenders_accounts.txt); do echo "importing $accts"; zmmailbox -z -m $accts postRestURL "//?fmt=tgz&resolve=skip" /tmp/all-users_calendars/$accts.tgz; done