mirror of
https://github.com/imapsync/imapsync.git
synced 2025-06-07 13:15:22 +02:00
2.178
This commit is contained in:
parent
f98c9946e5
commit
2f815205a9
72 changed files with 4567 additions and 1469 deletions
|
@ -1,41 +1,64 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# $Id: sync_loop_darwin.sh,v 1.2 2018/02/12 21:54:59 gilles Exp gilles $
|
||||
# $Id: sync_loop_darwin.sh,v 1.3 2022/01/10 08:03:46 gilles Exp gilles $
|
||||
|
||||
# Example for imapsync massive migration on Unix systems.
|
||||
# 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;
|
||||
# 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 line contains 6 columns, columns are parameter values for
|
||||
# The separator is the character semi-colon ";"
|
||||
# this separator character can be changed to any character
|
||||
# by changing IFS=';' in the while loop below.
|
||||
#
|
||||
# Each line contains 7 columns. These columns are the 6 parameter values
|
||||
# for the imapsync command options
|
||||
# --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.
|
||||
# plus an extra column for extra parameters and a trailing fake column
|
||||
# to avoid CR LF part going in the 7th parameter extra.
|
||||
# So don't forget the last semicolon, especially on MacOS systems.
|
||||
#
|
||||
# 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 add extra options in this script after the variable "$@"
|
||||
# Those options will be applied in every imapsync run, for every line.
|
||||
|
||||
# The imapsync command below is written in two lines to avoid a long line.
|
||||
# The character backslash \ at the end of the first line is means
|
||||
# "the command continues on the next line".
|
||||
#
|
||||
# Use character backslash \ at the end of each supplementary line,
|
||||
# except for the last line.
|
||||
#
|
||||
|
||||
# You can also pass extra options via the parameters of this script since
|
||||
# they will be in "$@"
|
||||
# they will be in "$@". Shell knowledge is your friend.
|
||||
|
||||
# The credentials filename "file.txt" used for the loop can be renamed
|
||||
# by changing "file.txt" below.
|
||||
|
||||
# The file file_failures.txt will contain the lines from file.txt that ended
|
||||
# up in error, for whatever reason. It's there to notice and replay easily
|
||||
# the failed imapsync runs. Is is emptied at the beginning of the loop run.
|
||||
# I let you junggle with it.
|
||||
|
||||
echo Looping on account credentials found in file.txt
|
||||
echo Looping on accounts credentials found in file.txt
|
||||
echo
|
||||
|
||||
{ while IFS=';' read h1 u1 p1 h2 u2 p2 fake
|
||||
line_counter=0
|
||||
# Empty the error listing
|
||||
> file_failures.txt
|
||||
{ while IFS=';' read h1 u1 p1 h2 u2 p2 extra fake
|
||||
do
|
||||
{ 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_bin_Darwin --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 ===="
|
||||
line_counter=`expr 1 + $line_counter`
|
||||
{ echo "$h1" | tr -d '\r' | egrep '^#|^ *$' ; } > /dev/null && continue # this skip commented lines in file.txt
|
||||
echo "==== Starting imapsync with --host1 $h1 --user1 $u1 --host2 $h2 --user2 $u2 $extra $@ ===="
|
||||
if ../imapsync_bin_Darwin --host1 "$h1" --user1 "$u1" --password1 "$p1" \
|
||||
--host2 "$h2" --user2 "$u2" --password2 "$p2" $extra "$@"
|
||||
then
|
||||
echo "success sync for line $line_counter "
|
||||
else
|
||||
echo "$h1;$u1;$p1;$h2;$u2;$p2;$extra;" | tee -a file_failures.txt
|
||||
fi
|
||||
echo "==== Ended imapsync with --host1 $h1 --user1 $u1 --host2 $h2 --user2 $u2 $extra $@ ===="
|
||||
echo
|
||||
done
|
||||
done
|
||||
} < file.txt
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue