This commit is contained in:
Nick Bebout 2011-03-12 02:43:55 +00:00
parent 6b377e54ad
commit f800803e4a
6 changed files with 84 additions and 28 deletions

View file

@ -1,5 +1,11 @@
#!/bin/cat #!/bin/cat
Christoph Nagelreiter
Christoph ran imapsync to migrate from
Microsoft MCIS to Cyrus IMAP.
16000 mailboxes, 15 GB.
Will he succeed ?
Ivan Zilic Schmidt Ivan Zilic Schmidt
Made me start the FAQ. Made me start the FAQ.
Suggested the --regextrans2 option. Suggested the --regextrans2 option.

View file

@ -1,15 +1,28 @@
RCS file: RCS/imapsync,v RCS file: RCS/imapsync,v
Working file: imapsync Working file: imapsync
head: 1.91 head: 1.94
branch: branch:
locks: strict locks: strict
gilles: 1.94
access list: access list:
symbolic names: symbolic names:
keyword substitution: kv keyword substitution: kv
total revisions: 91; selected revisions: 91 total revisions: 94; selected revisions: 94
description: description:
---------------------------- ----------------------------
revision 1.94 locked by: gilles;
date: 2004/06/15 03:42:56; author: gilles; state: Exp; lines: +13 -6
Added time stat
----------------------------
revision 1.93
date: 2004/06/14 23:13:55; author: gilles; state: Exp; lines: +18 -11
Added stats about messages transfered and messages skipped
----------------------------
revision 1.92
date: 2004/05/29 02:23:14; author: gilles; state: Exp; lines: +17 -13
Updated usage()
----------------------------
revision 1.91 revision 1.91
date: 2004/04/07 18:51:24; author: gilles; state: Exp; lines: +7 -6 date: 2004/04/07 18:51:24; author: gilles; state: Exp; lines: +7 -6
- Expunging the destination server is commented. - Expunging the destination server is commented.

6
README
View file

@ -2,14 +2,14 @@ NAME
imapsync - IMAP sync or copy tool. Synchronize mailboxes between two imapsync - IMAP sync or copy tool. Synchronize mailboxes between two
imap servers. imap servers.
$Revision: 1.91 $ $Revision: 1.94 $
INSTALL INSTALL
imapsync works fine under any Unix OS. imapsync works fine under any Unix OS.
imapsync works fine under Windows 2000 (at least) and ActiveState's 5.8 Perl imapsync works fine under Windows 2000 (at least) and ActiveState's 5.8 Perl
Get imapsync at Get imapsync at
http://www.linux-france.org/prj/imapsync/dist/ http://www.linux-france.org/prj/imapsync/dist/
You'll find a compressed tarball called imapsync-x.xx.tgz You'll find a compressed tarball called imapsync-x.xx.tgz
where x.xx is the version number. Untar the tarball where where x.xx is the version number. Untar the tarball where
@ -229,5 +229,5 @@ AUTHOR
teaching free open and gratis softwares. Don't hesitate to pay him for teaching free open and gratis softwares. Don't hesitate to pay him for
that services. that services.
$Id: imapsync,v 1.91 2004/04/07 18:51:24 gilles Exp $ $Id: imapsync,v 1.94 2004/06/15 03:42:56 gilles Exp gilles $

View file

@ -1 +1 @@
1.91 1.94

View file

@ -2,9 +2,10 @@
=head1 NAME =head1 NAME
imapsync - IMAP sync or copy tool. Synchronize mailboxes between two imap servers. imapsync - IMAP sync or copy tool. Synchronize mailboxes
between two imap servers.
$Revision: 1.91 $ $Revision: 1.94 $
=head1 INSTALL =head1 INSTALL
@ -12,7 +13,7 @@ $Revision: 1.91 $
imapsync works fine under Windows 2000 (at least) and ActiveState's 5.8 Perl imapsync works fine under Windows 2000 (at least) and ActiveState's 5.8 Perl
Get imapsync at Get imapsync at
http://www.linux-france.org/prj/imapsync/dist/ http://www.linux-france.org/prj/imapsync/dist/
You'll find a compressed tarball called imapsync-x.xx.tgz You'll find a compressed tarball called imapsync-x.xx.tgz
where x.xx is the version number. Untar the tarball where where x.xx is the version number. Untar the tarball where
@ -144,8 +145,9 @@ Gilles LAMIRAL lamiral@linux-france.org
=head1 LICENSE =head1 LICENSE
imapsync is free, gratis and open source software cover by the GNU General imapsync is free, gratis and open source software cover by
Public License. See the GPL file included in the distribution or the web site the GNU General Public License. See the GPL file included in
the distribution or the web site
http://www.gnu.org/licenses/licenses.html http://www.gnu.org/licenses/licenses.html
=head1 BUGS =head1 BUGS
@ -166,10 +168,10 @@ this problem is by using options --skipheader and
imapsync ... --skipheader '^X-.*' --skipsize imapsync ... --skipheader '^X-.*' --skipsize
Flags : with some IMAP servers the flags are not very well copied the Flags : with some IMAP servers the flags are not very well
first time. Run imapsync twice if you want the flags set correctly. copied the first time. Run imapsync twice if you want the
(fixed since 1.28 release but wait for a time before removing those flags set correctly. (fixed since 1.28 release but wait for
lines) a time before removing those lines)
Report any bugs to the author: lamiral@linux-france.org Report any bugs to the author: lamiral@linux-france.org
@ -269,7 +271,7 @@ Gilles LAMIRAL earn his living writing, installing,
configuring and teaching free open and gratis configuring and teaching free open and gratis
softwares. Don't hesitate to pay him for that services. softwares. Don't hesitate to pay him for that services.
$Id: imapsync,v 1.91 2004/04/07 18:51:24 gilles Exp $ $Id: imapsync,v 1.94 2004/06/15 03:42:56 gilles Exp gilles $
=cut =cut
@ -301,13 +303,16 @@ my(
$mess_size_total_trans, $mess_size_total_trans,
$mess_size_total_skipped, $mess_size_total_skipped,
$mess_size_total_error, $mess_size_total_error,
$mess_trans, $mess_skipped,
$timeout, # whr (ESS/PRW) $timeout, # whr (ESS/PRW)
$timestart, $timeend, $timediff,
); );
use vars qw ($opt_G); # missing code for this will be option. use vars qw ($opt_G); # missing code for this will be option.
$rcs = ' $Id: imapsync,v 1.91 2004/04/07 18:51:24 gilles Exp $ '; $rcs = ' $Id: imapsync,v 1.94 2004/06/15 03:42:56 gilles Exp gilles $ ';
$rcs =~ m/,v (\d+\.\d+)/; $rcs =~ m/,v (\d+\.\d+)/;
$VERSION = ($1) ? $1 : "UNKNOWN"; $VERSION = ($1) ? $1 : "UNKNOWN";
@ -319,6 +324,7 @@ $md5_supported = md5_supported();
$mess_size_total_trans = 0; $mess_size_total_trans = 0;
$mess_size_total_skipped = 0; $mess_size_total_skipped = 0;
$mess_size_total_error = 0; $mess_size_total_error = 0;
$mess_trans = $mess_skipped = 0;
sub md5_supported { sub md5_supported {
@ -343,8 +349,8 @@ $error=0;
my $banner = join("", my $banner = join("",
'$RCSfile: imapsync,v $ ', '$RCSfile: imapsync,v $ ',
'$Revision: 1.91 $ ', '$Revision: 1.94 $ ',
'$Date: 2004/04/07 18:51:24 $ ', '$Date: 2004/06/15 03:42:56 $ ',
"\n", "\n",
"Mail::IMAPClient version used here is ", "Mail::IMAPClient version used here is ",
$VERSION_IMAPClient, " auth md5 : $md5_supported", $VERSION_IMAPClient, " auth md5 : $md5_supported",
@ -392,7 +398,7 @@ unless ($md5_supported) {
print "Auth $authmech supported by IMAPClient $VERSION_IMAPClient\n"; print "Auth $authmech supported by IMAPClient $VERSION_IMAPClient\n";
} }
$timestart = time();
$debugimap and print "From connection\n"; $debugimap and print "From connection\n";
$from = login_imap($host1, $port1, $user1, $password1, $debugimap, $timeout); $from = login_imap($host1, $port1, $user1, $password1, $debugimap, $timeout);
@ -673,12 +679,14 @@ FOLDER: foreach my $f_fold (@f_folders) {
# UIDPLUS capability else just a ref # UIDPLUS capability else just a ref
print "Copied msg id [$f_msg] to folder $t_fold msg id [$new_id]\n"; print "Copied msg id [$f_msg] to folder $t_fold msg id [$new_id]\n";
$mess_size_total_trans += $f_size; $mess_size_total_trans += $f_size;
$mess_trans += 1;
} }
} }
next MESS; next MESS;
}else{ }else{
$debug and print "Message id [$m_id] found in t:$t_fold\n"; $debug and print "Message id [$m_id] found in t:$t_fold\n";
$mess_size_total_skipped += $f_size; $mess_size_total_skipped += $f_size;
$mess_skipped += 1;
} }
#$debug and print "MESSAGE $m_id\n"; #$debug and print "MESSAGE $m_id\n";
@ -730,12 +738,19 @@ FOLDER: foreach my $f_fold (@f_folders) {
} }
} }
$timeend = time();
$timediff = $timeend - $timestart;
stats(); stats();
exit(1) if($error); exit(1) if($error);
sub stats { sub stats {
print "++++ Statistics ++++\n"; print "++++ Statistics ++++\n";
print "Time : $timediff sec\n";
print "Messages transfered : $mess_trans\n";
print "Messages skipped : $mess_skipped\n";
print "Total bytes transfered : $mess_size_total_trans\n"; print "Total bytes transfered : $mess_size_total_trans\n";
print "Total bytes skipped : $mess_size_total_skipped\n"; print "Total bytes skipped : $mess_size_total_skipped\n";
print "Total bytes error : $mess_size_total_error\n"; print "Total bytes error : $mess_size_total_error\n";
@ -879,15 +894,18 @@ Several options are mandatory.
--regextrans2 <regex> : Apply the whole regex to each destination folders. --regextrans2 <regex> : Apply the whole regex to each destination folders.
--sep1 <char> : separator in case namespace is not supported. --sep1 <char> : separator in case namespace is not supported.
--sep2 <char> : idem. --sep2 <char> : idem.
--delete : delete messages in "from" imap server after --delete : delete messages in source imap server after
a successful transfert. useful in case you a successful transfert. Useful in case you
want to migrate from one server to another one. want to migrate from one server to another one.
With imap, delete tags messages as deleted, they With imap, delete tags messages as deleted, they
are not really deleted. See expunge. are not really deleted. See expunge.
--expunge : expunge messages on both account. --expunge : expunge messages on source account.
expunge delete messages marked deleted. expunge really deletes messages marked deleted.
expunge is made at the begining so newly expunge is made at the begining on the
transfered messages won't be expunged. source server only. newly transfered messages
are expunged if option --expunge is given.
no expunge is done on destination account but
it will change in future releases.
--syncinternaldates : set the internal dates on host2 same as host1 --syncinternaldates : set the internal dates on host2 same as host1
--maxsize <int> : skip messages larger than <int> bytes --maxsize <int> : skip messages larger than <int> bytes
--maxage <int> : skip messages older than <int> days. --maxage <int> : skip messages older than <int> days.

View file

@ -1,8 +1,14 @@
#!/bin/sh #!/bin/sh
# $Id: tests.sh,v 1.17 2004/04/07 18:13:29 gilles Exp $ # $Id: tests.sh,v 1.19 2004/06/15 03:42:16 gilles Exp gilles $
# $Log: tests.sh,v $ # $Log: tests.sh,v $
# Revision 1.19 2004/06/15 03:42:16 gilles
# success on bigtransfer()
#
# Revision 1.18 2004/06/14 23:03:41 gilles
# Added big_transfert()
#
# Revision 1.17 2004/04/07 18:13:29 gilles # Revision 1.17 2004/04/07 18:13:29 gilles
# Added lp_regextrans2() # Added lp_regextrans2()
# #
@ -420,7 +426,20 @@ bad_host()
} }
big_transfert()
{
date1=`date`
{ ./imapsync \
--host1 louloutte --user1 gilles \
--passfile1 /var/tmp/secret \
--host2 plume --user2 tete@est.belle \
--passfile2 /var/tmp/secret.tete \
--subscribed || \
true
}
date2=`date`
echo3 $date1 $date2
}
# mandatory tests # mandatory tests