Jump to content

Main Page/MailMigrationScript

From TetraWiki
Revision as of 04:30, 19 July 2014 by Vijay (talk | contribs) (Created page with "Category: BLS INTERNATIONAL Category: Zimbra ===='''Zimbra Script to Migrate mails from old domain to new domain'''==== Step 1:- Create a file imapsync.sh and add th...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Zimbra Script to Migrate mails from old domain to new domain

Step 1:- Create a file imapsync.sh and add the following entries. Before starting this you need to create a file having all the user account that you want to migrate.

Script to automate the synchronizations of multiple mail accounts

!/bin/bash

Date=`date +%d:%m:%Y-%T`

host1="imap.asia.secureserver.net"

host1="mail.blsindia-usa.com"

host2="97.74.118.155"

domain1="blsindia-usa.com"

domain2="blsinternational.net"

user=`cat /root/blsusadtl`

pass="BL@#usa14"

for i in $user

do

/usr/bin/imapsync --allowsizemismatch --timeout 60 --host1 $host1 --user1 $i@$domain1 --password1 $pass --host2 $host2 --user2 $i@$domain2 --password2 $pass --noauthmd5 --nosyncacls --subscribe_all --syncinternaldates --regextrans2 's/Inbox/INBOX/' --regextrans2 's,\\,/,g' --regextrans2 's,//,++,g' --skipheader '^X-|^Received|^Content-|^Subject|^References|^Mime|^Cc' --fast --skipsize

if [ $? == 0 ]; then

echo " $i@$domain2 synchronization has been done successfully till $Date ." >> /root/imapblsusa.log

else

echo " $i@$domain2 synchronization has not been done at $Date . Un-successfull" >> /root/imapblsusa.log

fi

sleep 3

done ~


Run this script in backend using screen cammand

Type screen and then press enter

screen

sh -x imapsync.sh