Page 1 of 1

imapsync-ing mailboxes

Posted: Thu May 10, 2007 7:11 pm
by leigh
Hi all,
I'm having some trouble with this. I am attemping to backup all of our mail from one V10 server to another, just in case the upgrade to v11 goes pear-shaped.
I have created identical users on the new server as are currently on the old server. Then I run this script on the new server:

Code: Select all

#!/usr/bin/perl
use strict;
use warnings;
my @users=`omshowu -m all -i`;          # User names
shift @users;                           # Get rid of 'admin'
shift @users;                           # Get rid of 'sxqueryadmin'
my @failed_users;                       # Keep track of who was not synced.
foreach my $punter(@users)
{
        chomp $punter;                  # Remove any trailing newlines.
        print "Doing $punter\n";
        my $command="/usr/bin/imapsync --host1 172.16.1.101 --user1 mboxadmin:admin_username:$punter --password1 admin_password --host2 localhost --user2 mboxadmin:admin_username:$punter --password2 admin_password --exclude '\"Public Folders\"'";
        my @output=`$command`;
        my $return_code=$?>>8;
        unless($return_code==0)
        {

                print "Return code $return_code\nOutput follows:\n@output\n";
                push (@failed_users,$punter);
        }
}

print "The following users could not be synchronised:\n";
print join("\n",@failed_users);
print "\n";


For the most part, it works, except for "public folders". I get the following error:

Code: Select all

To Folder "Public Folders" : Could not select 35 NO cannot SELECT that mailbox


So I presume I have the "exclude" syntax wrong. Can anyone tell me how this should be done?

Posted: Fri May 11, 2007 4:01 am
by btisdall
I don't think you should have those escaped double quotes there - it works for me without them.

Out of curiosity why do you not just copy the mailstore?

Posted: Mon May 14, 2007 9:20 pm
by leigh
Hmm, Still the same result.
Oddly, I can't select the public folders on the destination server at all, using an IMAP client. Do I need to set up any permissions on it?
I seem to be unable to tell imapsync not to use that folder, and unable to get any IMAP client to talk to it at all. To top it all off, we don't even use the damn things.

Out of curiosity why do you not just copy the mailstore?

'Cos the last time I tried that it ended in total disaster. It broke my backup machine completely, and I'm a bit hesitant to try it again.

Posted: Tue May 15, 2007 7:00 am
by btisdall
Tarring the mailstore should be the quickest & best way to backup/move/copy.

Just remember to preserve perms when you restore (use the 'p' opt) & make sure the scalix UID & GID are the same on both systems. In my (admittedly not extensive) experience with imapsync the process could take some considerable time & you might need to strip off headers to avoid the process choking. Plus you have to backup your config separately of course.

However, sticking with IMAP, I think it's normal for "public folders" to be non-selectable:

Code: Select all

[...]
1 list / *
* LIST () "/" INBOX
* LIST (\X-SpecialFolder=SentItems) "/" "Sent Items"
* LIST (\X-SpecialFolder=DeletedItems) "/" "Deleted Items"
* LIST (\X-FolderClass=IPF.Appointment \X-SpecialFolder=Calendar) "/" Calendar
* LIST (\X-FolderClass=IPF.Contact \X-SpecialFolder=Contacts) "/" Contacts
* LIST (\X-SpecialFolder=Drafts) "/" Drafts
* LIST (\X-FolderClass=IPF.Journal \X-SpecialFolder=Journal) "/" Journal
* LIST (\X-FolderClass=IPF.StickyNote \X-SpecialFolder=Notes) "/" Notes
* LIST (\X-FolderClass=IPF.Task \X-SpecialFolder=Tasks) "/" Tasks
* LIST () "/" Trash
* LIST () "/" Filed
* LIST () "/" Sent
* LIST () "/" SPAM
* LIST (\NoSelect) "/" "Public Folders"
[...]


I tried to replicate your error more closely as previously I used a shell script:

Code: Select all

#!/usr/bin/perl
$command="/usr/bin/imapsync --host1 localhost --port1 143 --user1 bentis --password1 secret --noauthmd5 --host2 localhost --port2 1143 --user2 bentis --password2 secret --noauthmd5 --exclude 'Public Folders'";
@output=`$command`;
print "@output\n";


In the output I'm getting:

Code: Select all

[...]
Excluding folders matching pattern 'Public Folders'
[..]


So it still seems to work here.

Odd... the only significant difference left between our commands that I can see is I'm not using mboxadmin, perhaps this is relevent?