mirror of
https://github.com/imapsync/imapsync.git
synced 2025-07-23 18:55:55 +02:00
1.670
This commit is contained in:
parent
f1987d5e52
commit
b7c835d670
134 changed files with 44448 additions and 2810 deletions
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
# $Id: archive_per_month,v 1.6 2013/04/18 15:08:18 gilles Exp gilles $
|
||||
# $Id: archive_per_month.sh,v 1.7 2015/11/05 17:31:33 gilles Exp gilles $
|
||||
|
||||
# Translate Jan to 01, Feb to 02 etc.
|
||||
month_number() {
|
||||
|
@ -57,5 +57,5 @@ for year_archive in 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004
|
|||
done
|
||||
|
||||
|
||||
# End of $Id: archive_per_month,v 1.6 2013/04/18 15:08:18 gilles Exp gilles $
|
||||
# End of $Id: archive_per_month.sh,v 1.7 2015/11/05 17:31:33 gilles Exp gilles $
|
||||
|
|
@ -1,14 +1,19 @@
|
|||
# Example file.txt for imapsync massive migration.
|
||||
#
|
||||
# Each line contains 4 columns, columns are parameters for --user1 --password1 --user2 --password2
|
||||
# Each line contains 6 columns, columns are parameters 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.
|
||||
#
|
||||
# Windows: see the script examples/sync_loop_windows.bat
|
||||
# Unix: see the script examples/sync_loop_unix.sh
|
||||
#
|
||||
#
|
||||
# Now the data example
|
||||
user001_1;password001_1;user001_2;password001_2
|
||||
user002_1;password002_1;user002_2;password002_2
|
||||
user003_1;password003_1;user003_2;password003_2
|
||||
host001_1;user001_1;password001_1;host001_2;user001_2;password001_2;
|
||||
host002_1;user002_1;password002_1;host002_2;user002_2;password002_2;
|
||||
host003_1;user003_1;password003_1;host003_2;user003_2;password003_2;
|
||||
# Another comment blabla
|
||||
user004_1;password004_1;user004_2;password004_2
|
||||
test1;secret1;test2;secret2
|
||||
host004_1;user004_1;password004_1;user004_2;password004_2;
|
||||
# This last example is a real one, ie, truly working in the real world.
|
||||
test1.lamiral.info;test1;secret1;test2.lamiral.info;test2;secret2;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,32 +1,43 @@
|
|||
@REM
|
||||
@REM $Id: sync_loop_windows.bat,v 1.9 2015/03/26 04:34:44 gilles Exp gilles $
|
||||
@REM $Id: sync_loop_windows.bat,v 1.13 2015/11/26 20:35:09 gilles Exp gilles $
|
||||
@REM
|
||||
@REM imapsync massive sync example batch for Windows users
|
||||
@REM lines beginning with @REM are just comments
|
||||
@REM
|
||||
@REM Replace "test1.lamiral.info" and "test2.lamiral.info" with your own values
|
||||
@REM See also http://imapsync.lamiral.info/FAQ.d/FAQ.Massive.txt
|
||||
@REM
|
||||
@REM You should get familiar with a simple and single imapsync transfer before
|
||||
@REM playing with this loop batch file. See and play with imapsync_example.bat
|
||||
@REM
|
||||
@REM ==== Credentials file ====
|
||||
|
||||
@REM Credentials data are supposed to be in the file named "file.txt" in the following format
|
||||
@REM user001_1;password001_1;user001_2;password001_2
|
||||
@REM ==== How it works ====
|
||||
@REM
|
||||
@REM The files
|
||||
@REM * sync_loop_windows.bat
|
||||
@REM * imapsync or imapsync.exe and
|
||||
@REM * file.txt
|
||||
@REM are supposed to be in the same directory.
|
||||
|
||||
|
||||
@REM ==== Credentials file ====
|
||||
@REM
|
||||
@REM Credentials data are supposed to be in the file named "file.txt" in the following format:
|
||||
@REM host001_1;user001_1;password001_1;host001_2;user001_2;password001_2;
|
||||
@REM ...
|
||||
@REM Separator is character semi-colon ; it can be replaced with any character by changing
|
||||
@REM the part "delims=;" in the FOR loop below.
|
||||
@REM Each data line contains 4 columns, columns are parameters for --user1 --password1 --user2 --password2
|
||||
@REM
|
||||
@REM Each data line contains 6 columns, columns are parameter values for
|
||||
@REM --host1 --user1 --password1 --host2 --user2 --password2
|
||||
@REM and a fake parameter to avoid CRLF part going into the 6th parameter password2.
|
||||
@REM The credentials filename "file.txt" used for the loop can be renamed
|
||||
@REM by changing "SET csvfile=file.txt" below.
|
||||
|
||||
@REM ==== Log files ====
|
||||
|
||||
@REM
|
||||
@REM Log files are in the LOG_imapsync sub-folder
|
||||
|
||||
@REM ==== Parallel executions ====
|
||||
|
||||
@REM
|
||||
@REM If you want to do parallel runs of imapsync then this current script is a good start.
|
||||
@REM Just copy it several times and replace, on each copy, the csvfile variable value.
|
||||
@REM Instead of SET csvfile=file.txt write for example
|
||||
|
@ -37,7 +48,7 @@
|
|||
@REM into file01.txt file02.txt etc.
|
||||
@REM After that, just double-clic on each batch file to launch each process
|
||||
@REM
|
||||
@REM Be aware that imapsync can be also a cpu/memory cruncher on the remote imap servers,
|
||||
@REM Be aware that imapsync can be a cpu/memory cruncher on the remote imap servers,
|
||||
@REM especially in parallel runs. The best practice rule to answer the question
|
||||
@REM "how many processes in parallel can we run?" is:
|
||||
@REM 1) Measure the total transfer rate by adding each one printed in each run.
|
||||
|
@ -46,25 +57,38 @@
|
|||
@REM Note N as the number of parallel runs you got until then.
|
||||
@REM 4) Only keep N-2 parallel runs for the future.
|
||||
|
||||
@REM For Parallel executions there is also a PowerShell script written by
|
||||
@REM For Parallel executions, there is also a PowerShell script written by
|
||||
@REM CARTER Alex explained and located on the imapsync archive list:
|
||||
@REM http://www.linux-france.org/prj/imapsync_list/msg02137.html
|
||||
|
||||
@REM ==== The real stuff ====
|
||||
@REM ==== The real stuff is below ====
|
||||
|
||||
@REM @echo off
|
||||
|
||||
@REM First let's go in the directory this batch is
|
||||
CD /D %~dp0
|
||||
|
||||
@REM Let's get arguments of this batch, they will be added to imapsync arguments, if any.
|
||||
@SET arguments= & @SET command=%~0
|
||||
@IF %1. EQU . GOTO args_end
|
||||
:args_loop
|
||||
@SET arguments=%arguments% %1 & @SHIFT
|
||||
@IF %1. NEQ . GOTO args_loop
|
||||
@ECHO Command and arguments: %command% %arguments%
|
||||
:args_end
|
||||
|
||||
@REM Now the loop on the csv file.
|
||||
SET csvfile=file.txt
|
||||
|
||||
FOR /F "tokens=1,2,3,4 delims=; eol=#" %%G IN (%csvfile%) DO (
|
||||
@ECHO ==== Syncing from account %%G to account %%I ====
|
||||
FOR /F "tokens=1,2,3,4,5,6,7 delims=; eol=#" %%G IN (%csvfile%) DO (
|
||||
@ECHO ==== Starting imapsync from --host1 %%G --user1 %%H to --host2 %%J --user2 %%K ====
|
||||
@ECHO.
|
||||
|
||||
imapsync ^
|
||||
--host1 test1.lamiral.info --user1 %%G --password1 %%H ^
|
||||
--host2 test2.lamiral.info --user2 %%I --password2 %%J
|
||||
--host1 %%G --user1 %%H --password1 %%I ^
|
||||
--host2 %%J --user2 %%K --password2 %%L %arguments%
|
||||
|
||||
@ECHO.==== End syncing from account %%G to account %%I ====
|
||||
@ECHO ==== Ended imapsync from --host1 %%G --user1 %%H to --host2 %%J --user2 %%K ====
|
||||
@ECHO.
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue