This commit is contained in:
Nick Bebout 2015-12-03 11:16:32 -06:00
parent f1987d5e52
commit b7c835d670
134 changed files with 44448 additions and 2810 deletions

View file

@ -1,34 +1,40 @@
#!/bin/sh
#
# $Id: sync_loop_unix.sh,v 1.4 2014/05/22 14:22:15 gilles Exp gilles $
# $Id: sync_loop_unix.sh,v 1.6 2015/11/04 18:23:04 gilles Exp gilles $
# Example for imapsync massive migration on Unix systems.
#
# Data is supposed to be in file.txt in the following format
# user001_1;password001_1;user001_2;password001_2
# See also http://imapsync.lamiral.info/FAQ.d/FAQ.Massive.txt
#
# Data is supposed to be in file.txt in the following format:
# host001_1;user001_1;password001_1;host001_2;user001_2;password001_2;
# ...
# Separator is character semi-colon ";" it can be changed by any character changing IFS=';'
# in the while loop below.
# Each data line contains 4 columns, columns are parameters for --user1 --password1 --user2 --password2
# # Each line contains 6 columns, columns are parameter values for
# --host1 --user1 --password1 --host2 --user2 --password2
# and a trailing empty fake column to avaid CR LF part going
# in the 6th parameter password2. Don't forget the last semicolon.
#
# For Mac users you may have to add a fake fifth element in file.txt to avoid that a CR character
# goes in the p2 variable. Change also the read command to "read u1 p1 u2 p2 fake".
#
# Replace "imap.side1.org" and "imap.side2.org" with your own hostname values.
# You can add extra options after --password2 "$p2"
# Use character backslash \ at the end of each suplementary line, exept for the last one.
# You can add extra options after the variable "$@"
# Use character backslash \ at the end of each suplementary line, except for the last one.
# You can also pass extra options via the parameters of this script since
# they will be in "$@"
# The credentials filename "file.txt" used for the loop can be renamed
# by changing "file.txt" below.
echo Looping on account credentials found in file.txt
echo
{ while IFS=';' read u1 p1 u2 p2
{ while IFS=';' read h1 u1 p1 h2 u2 p2 fake
do
{ echo "$u1" | egrep "^#" ; } > /dev/null && continue # this skip commented lines in file.txt
echo "==== Syncing user $u1 to user $u2 ===="
imapsync --host1 imap.side1.org --user1 "$u1" --password1 "$p1" \
--host2 imap.side2.org --user2 "$u2" --password2 "$p2"
echo "==== End syncing user $u1 to user $u2 ===="
{ echo "$h1" | egrep "^#" ; } > /dev/null && continue # this skip commented lines in file.txt
echo "==== Starting imapsync from host1 $h1 user1 $u1 to host2 $h2 user2 $u2 ===="
imapsync --host1 "$h1" --user1 "$u1" --password1 "$p1" \
--host2 "$h2" --user2 "$u2" --password2 "$p2" \
"$@"
echo "==== Ended imapsync from host1 $h1 user1 $u1 to host2 $h2 user2 $u2 ===="
echo
done
} < file.txt