Results 1 to 1 of 1

Thread: Little Script for parallel imapsync .. test it..

  1. #1
    Join Date
    Dec 2008
    Rep Power

    Default Little Script for parallel imapsync .. test it..

    Im not really a unix shell script guru, but it works very well for me.
    So, here is my little script. It take a text file for argument. This text file its your users and passwords separated by ",". After, they split the file into N files and after, call another script to do the parallell imap sync.
    The password used for the users need to be the same for the source and dest server.

    This scripts was used to sync Mboxes from Solaris+Cyrus+salsdb to Zimbra
    if [ $# -ge 1 ]
    if [ -e $FILE ]
    echo "How many lines splitted per file: "
    #Remember, more files do more imapsync process.
    read lines
    split -l $lines $FILE
    for filesplitted in `ls x*`;
    ./ $filesplitted &
    echo "Launching $counter process"
    echo "File: $FILE not found.."
    echo "Use: $0 fileuserlist"

    The second script its where the imapsync do all the things.. There, you need to check the variables: DOMAINSOURCE, DOMAINDST using the format "" if needed. And also, need check SERVERSOURCE and SERVERDST.
    All log is kept on a file called: log-imapsync$1.txt where $1 its the name of the used splitted file.
    Take note about the regextrans2 to match the source default folders to zimbra default folders.
    #---- Some Info needed..------------
    # Set domain only if youre working with virtual domains.
    # Set domain for zimbra users
    # Set Source Server
    # Set Dst Zimbra Server

    cp /dev/null log-imapsync$1.txt
    echo " -----------------------------------------" >>log-imapsync$1.txt
    for mbox in `cat $1`;
    # The Default separator for the user file its ",". Here you could change it.
    email=`echo $mbox |cut -f 1 -d ","`
    password=`echo $mbox |cut -f 2 -d ","`
    echo "Copying MBOX for user: [$email] from [$SERVERSOURCE] to [$SERVERDST]." >>log-imapsync$1.txt
    # -- Below all its one line.
    imapsync --buffersize 8192000 --nosyncacls --syncinternaldates --host1 $SERVERSOURCE --user1 $email$DOMAINSOURCE --password1 $password --host2 $SERVERDST --user2 $email$DOMAINDST --password2 $password --ssl2 --regextrans2 's/^INBOX.Borradores$/Drafs/i' --regextrans2 's/^sent-mail$/Sent/i' --regextrans2 's/^Sent Items$/Sent/i' --regextrans2 's/^Sent Messages$/Sent/i' --regextrans2 's/^INBOX.Enviados$/Sent/i' --noauthmd5 >> log-imapsync$1.txt
    # ---- End of line.
    if [ $? = 0 ]
    echo "MBOX: [$email] from [$SERVERSOURCE] syncronized with [$SERVERDST]"
    echo "Fail [$email] cant be syncronized"
    echo "-------------------------------------------------------" >>log-imapsync$1.txt
    echo "Sync Done..." >>log-imapsync$1.txt
    echo "Removing splitted file $1..."
    rm $1

    Also, u need to activate the cleartext auth on Zimbra server.

    Its really a basic scripts, but its works so well for me.. I hope this scripts will be usefull for someone.

    Sorry for my english..
    Last edited by sevilla; 01-18-2010 at 08:27 AM.

Similar Threads

  1. [Migration] Imapsync TOO slow.
    By ElMoRsA in forum Installation
    Replies: 6
    Last Post: 08-18-2009, 09:55 AM
  2. zimbra opesource Backup Script Problem!
    By tashi in forum Administrators
    Replies: 4
    Last Post: 03-30-2009, 11:49 PM
  3. Zimbra Open Source Backup Help
    By ayush1440 in forum Administrators
    Replies: 8
    Last Post: 11-13-2008, 03:56 AM
  4. Zimbra 5.0.X Auto Install Script on openSUSE 10.3
    By vavai in forum Installation
    Replies: 0
    Last Post: 05-19-2008, 01:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts