Problem with reconstruct

nbouthors at nbi.fr nbouthors at nbi.fr
Tue Feb 8 08:23:07 EST 2005


Quoting Lars Kristiansen <lars+lister.cyrus at adventuras.no>:
> In short, dump to text on the old machine and import from text on the new
> is the way to go.

The "old server" install was all fucked up, and no text backup was available. I
used the following script to dump mailbox lists and ACL on "old host" and
lauched the result on "new server". I supposed it does the same thing than
transfering the flat text file but does it ?

use IMAP::Admin;

$imap = IMAP::Admin->new('Server' => 'localhost', 'Login' => 'cyrus',
                         'Password' => '****');

@list = $imap->list("user.*");
foreach $mailbox (@list) {
        next if ($mailbox =~ /user.[A-Z_]+\..+/);
        printf("\$imap->create(\"%s\");\n", lc($mailbox));
        %acl = $imap->get_acl($mailbox);
        foreach $user (keys %acl) {
                printf("\$imap->set_acl(\"%s\", \"%s\", \"%s\");\n",
                       lc($mailbox), lc($user), $acl{$user} );
        }
        @quota = $imap->get_quota($mailbox);
        if ($#quota > 0) {
                printf("\$imap->set_quota(\"%s\", %d);\n",
                       lc($quota[0]), $quota[2] );
        }
}



---
Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html




More information about the Info-cyrus mailing list