Jump to content

Main Page/MailMigrationScript: Difference between revisions

From TetraWiki
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..."
 
No edit summary
 
Line 2: Line 2:
[[Category: Zimbra]]
[[Category: Zimbra]]


===='''Zimbra Script to Migrate mails from old domain to new domain'''====
===='''Zimbra Script to Migrate mails from old domain to new domain for BLS International'''====


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.
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.
Line 8: Line 8:
Script to automate the synchronizations of multiple mail accounts
Script to automate the synchronizations of multiple mail accounts


!/bin/bash
!/bin/bash
 
Date=`date +%d:%m:%Y-%T`
Date=`date +%d:%m:%Y-%T`
host1="imap.asia.secureserver.net"
 
host1="mail.blsindia-usa.com"
host1="imap.asia.secureserver.net"
host2="97.74.118.155"
 
domain1="blsindia-usa.com"
host1="mail.blsindia-usa.com"
domain2="blsinternational.net"
 
user=`cat /root/blsusadtl`
host2="97.74.118.155"
pass="BL@#usa14"
 
for i in $user
domain1="blsindia-usa.com"
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
domain2="blsinternational.net"
if [ $? == 0 ]; then
 
echo " $i@$domain2 synchronization has been done successfully till $Date ." >> /root/imapblsusa.log
user=`cat /root/blsusadtl`
else
 
echo " $i@$domain2 synchronization has not been done at $Date . Un-successfull" >> /root/imapblsusa.log
pass="BL@#usa14"
fi
 
sleep 3
for i in $user
done
 
    
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
~    




Line 53: Line 35:
Type screen and then press enter
Type screen and then press enter


screen
screen
 
sh -x imapsync.sh
sh -x imapsync.sh

Latest revision as of 07:13, 19 July 2014


Zimbra Script to Migrate mails from old domain to new domain for BLS International[edit]

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[edit]

Type screen and then press enter

screen
sh -x imapsync.sh