mirror of
https://github.com/imapsync/imapsync.git
synced 2025-06-07 13:15:22 +02:00
1.592
This commit is contained in:
parent
428581af1e
commit
459f6a81cb
151 changed files with 10053 additions and 1910 deletions
|
@ -1,30 +1,35 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# $Id: sync_loop_unix.sh,v 1.2 2012/12/23 08:02:46 gilles Exp gilles $
|
||||
# $Id: sync_loop_unix.sh,v 1.4 2014/05/22 14:22:15 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
|
||||
#...
|
||||
# Separator is character semi-colon ; it can be changed by any character changing IFS=';'
|
||||
# user001_1;password001_1;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
|
||||
#
|
||||
# Replace "imap.side1.org" and "imap.side2.org" with your own hostname values
|
||||
# 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.
|
||||
|
||||
# This loop will also create a log file called LOG/log_${u2}_$NOW.txt for each account transfer
|
||||
# where u2 is just a variable containing the user2 account name, and NOW is the current date_time
|
||||
|
||||
mkdir -p LOG
|
||||
echo Looping on account credentials found in file.txt
|
||||
echo
|
||||
|
||||
{ while IFS=';' read u1 p1 u2 p2
|
||||
do
|
||||
{ echo "$u1" | egrep "^#" ; } > /dev/null && continue
|
||||
NOW=`date +%Y_%m_%d_%H_%M_%S`
|
||||
echo syncing to user "$u2"
|
||||
imapsync --host1 imap.side1.org --user1 "$u1" --password1 "$p1" \
|
||||
--host2 imap.side2.org --user2 "$u2" --password2 "$p2" \
|
||||
> LOG/log_${u2}_$NOW.txt 2>&1
|
||||
{ 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
|
||||
done
|
||||
} < file.txt
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue