Created
November 8, 2016 14:47
-
-
Save deanrock/49bbf7e68df84f10e46cfe14890d8b7a to your computer and use it in GitHub Desktop.
Generate shell commands for migrating mail boxes from IMAP provider to Zimbra
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
host1 = 'source.example.com' | |
host2 = 'destination.example.com' | |
cos = 'cos-of-group-for-the-account' | |
data = """[email protected] password | |
[email protected] password3 | |
[email protected] password2""" | |
accounts = [] | |
for a in data.split('\n'): | |
u,p = a.split(' ') | |
accounts.append({ | |
"user": u, | |
"password": p | |
}) | |
print "#!/bin/bash" | |
print "set -e" | |
for acc in accounts: | |
print "# account %s" % (acc['user']) | |
print "zmprov ca %s %s zimbraCOSid %s" % (acc['user'], acc['password'], cos) | |
print "imapsync --buffersize 8192000 --nosyncacls --subscribe --syncinternaldates --host1 %s --user1 %s --password1 %s --ssl1 --port1 993 --host2 %s --user2 %s --password2 %s -ssl2 --port2 993 --noauthmd5" % (host1, acc['user'], acc['password'], host2, acc['user'], acc['password']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment