The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

rsync or scp script for moving emails from one server to another

Discussion in 'E-mail Discussions' started by albatroz, Sep 21, 2016.

  1. albatroz

    albatroz Well-Known Member

    Joined:
    Mar 6, 2003
    Messages:
    266
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Virtual Orbis / Peru
    cPanel Access Level:
    Root Administrator
    Hello,
    We recently moved a domain to another server but some new emails were not moved
    so I am looking for a sample scp or rsync command that I could use to move the
    emails from the old server. The idea is something like this:

    Source: IP1 /home/account/mail/domain.com/*/new
    Destination: IP2 /home/account/mail/domain.com/*/new

    I did something like this for one account but I need to repeat the process for
    all the email accounts: scp * root@IP:/home/account/mail/domain.com/username/new

    Any suggestion?
     
  2. 24x7server

    24x7server Well-Known Member

    Joined:
    Apr 17, 2013
    Messages:
    1,182
    Likes Received:
    37
    Trophy Points:
    48
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Hello :),

    Yes, you can migrate your all email accounts mail from old server to new server with the following command.

    Code:
    rsync -av --progress /home/account/mail/domain.com/* DestinationServerIP:/home/account/mail/domain.com/
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    33,397
    Likes Received:
    922
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    Yes, it's possible to use a command like the one referenced in the previous response. Note you may want to run the following command on the destination server after copying the email data:

    Code:
    /scripts/mailperm --username
    Thank you.
     
  4. albatroz

    albatroz Well-Known Member

    Joined:
    Mar 6, 2003
    Messages:
    266
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Virtual Orbis / Peru
    cPanel Access Level:
    Root Administrator
    is there a way to force the recreation of index files of Dovecot after this sync process?
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    33,397
    Likes Received:
    922
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Yes, you can remove the index files via the following script, as they are regenerated upon login:

    Code:
    # /scripts/remove_dovecot_index_files
    /scripts/remove_dovecot_index_files
    
    Utility to remove Dovecot index files. Available options:
    
        --user [cPanel username]
    
            Remove Dovecot index files from all email accounts setup under the specified cPanel user.
            Can be specified more than once, to process multiple users at once.
    
        --reseller [reseller username]
    
            Remove Dovecot index files from all email accounts setup under all the cPanel accounts owned by the specified Reseller.
            Can be specified more than once, to process multiple resellers at once.
    
        --all
    
            Remove Dovecot index files from all email accounts setup on the server.
    
        --verbose
    
            Prints the full paths of the files being removed.
    
        --help
    
            Prints this help text.
    Thank you.
     
Loading...

Share This Page