helper-scripts/kopano/mig_mailbox.sh

37 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
IMAPSYNC_BIN=/usr/bin/kopano-migration-imap
#imapsync \
# --host1 test1.lamiral.info --user1 test1 --password1 secret1 \
# --host2 test2.lamiral.info --user2 test2 --password2 secret2
cat mig_mailbox.csv | grep -v '^#' | while read line ; do
ORIG_IMAP_SRV=`echo $line | awk -F':' '{ print $1 }'`
ORIG_IMAP_LOGIN=`echo $line | awk -F':' '{ print $2 }'`
ORIG_IMAP_PASS=`echo $line | awk -F':' '{ print $3 }'`
DEST_IMAP_SRV=`echo $line | awk -F':' '{ print $4 }'`
DEST_IMAP_LOGIN=`echo $line | awk -F':' '{ print $5 }'`
DEST_IMAP_PASS=`echo $line | awk -F':' '{ print $6 }'`
IMAPSYNC_LOG="$IMAPSYNC_LOGDIR/$ORIG_IMAP_LOGIN-`date +%y%m%d-%H:%M:%S`.log"
$IMAPSYNC_BIN \
--noreleasecheck --timeout1 1200 --timeout2 1200 \
--host1 $ORIG_IMAP_SRV --user1 $ORIG_IMAP_LOGIN --password1 "$ORIG_IMAP_PASS" \
--host2 $DEST_IMAP_SRV --user2 $DEST_IMAP_LOGIN --password2 "$DEST_IMAP_PASS" \
--useheader "Message-Id" \
--exclude 'Notes' \
--delete2 --delete2duplicates --expunge2 \
--regextrans2 's/Sent/&AMk-l&AOk-ments envoy&AOk-s/' \
--regextrans2 's/Drafts/Brouillons/' \
--regextrans2 's/Junk/Courrier ind&AOk-sirable/' \
--regextrans2 's/Trash/&AMk-l&AOk-ments supprim&AOk-s/'
if [ "$?" == "0" ] ; then
echo " : OK"
else
echo " : NOK"
fi
done