Hello all, I need to migrate a number of users from one mail server to another. I found a sample script online which I modified according to my needs:
Code:
mkdir -p LOG
{ while IFS=';' read u1 p1 u2 p2
do
{ echo "$u1" | egrep "^#" ; } > /dev/null && continue
NOW=`date +%Y_%m_%d_%H_%M_%S`
echo syncing to user "$u2"
imapsync --useheader 'Message-Id' --useheader 'Message-ID' --useheader 'Received' \
--host1 imap.side1.org --user1 "$u1" --password1 "$p1" \
--host2 imap.side2.org --user2 "$u2" --password2 "$p2" \
--useheader 'Message-ID' \
--useheader 'References' \
--useheader 'Received' \
--useheader 'Subject' \
--subscribe \
--skipsize \
--usecache \
> LOG/log_${u2}_$NOW.txt 2>&1
done
} < file.txt
The file.txt file has the usernames and passwords in this format:
Code:
user001_1;password001_1;user001_2;password001_2
user002_1;password002_1;user002_2;password002_2
I have a few questions as I have never used this program before. The official page has been helpful but there are a few things that aren't answered in plain English.
1) Will my script copy everything or just the inbox? (e.g. Templates, drafts, sent)
2) This won't delete anything on the source machine, will it? I want to keep everything on the source machine until I'm absolutely sure the new one is working perfectly.
3) Lets say the machine running the scripts suddenly disconnects from the network and so the script ends in an error. If I start the script again, will it skip over the messages that were already copied or will I end up with duplicates? Certain forum posts I've read seem to suggest that some people have gotten duplicates but not others, depending on the options.
4) Is there anything that can be done to make this more efficient?
EDIT:
I attempted to sync an email account as a test. It didn't delete or duplicate any messages. It copied everything perfectly: templates, sent, inbox, etc. I still have a question about #4 though. The total file size I need to copy is about 160GB.