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.

How can I restore multiple accounts from cPanel backups?

Discussion in 'General Discussion' started by emurad, Mar 3, 2011.

  1. emurad

    emurad Member

    Joined:
    Mar 3, 2011
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    I have an incremental cPanel backup and I need to restore +20 accounts. How can I do that from shell or any easier way than going through WHM and restoring them one by one?

    Thanks.
     
  2. LinuxTechie

    LinuxTechie Well-Known Member

    Joined:
    Jan 22, 2011
    Messages:
    502
    Likes Received:
    2
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Hello,

    To restore a full backup file, simply move the file (usually named as username.tar.gz or cpmove-username.tar.gz) to /home directory (or /usr/home, /web, /home2, /home3, /root, /usr directory if applicable). Then login to WHM (WebHost Manager), and click on Restore a Full Backup/cpmove file link under the Backup section. Enter the user name for the account to restore in the text field after “Enter the username for the account you wish to restore”. Finally click on Restore button and wait for the restoration process to complete.

    From shell :

    /scripts/restorepkg username
     
  3. emurad

    emurad Member

    Joined:
    Mar 3, 2011
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Thanks but as I stated it's an incremental backup. There are no .tar.gz files.
     
  4. LinuxTechie

    LinuxTechie Well-Known Member

    Joined:
    Jan 22, 2011
    Messages:
    502
    Likes Received:
    2
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Hello,

    You just have to the tar the user backup directory in the form .tar.gz and need to copy it to /home partition.

    Below given command will help you to create the user backup directory in the format.

    $ tar -zcvf user.tar.gz user
     
  5. jamshed_11946

    jamshed_11946 Registered

    Joined:
    Aug 19, 2010
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Sorry to bump this thread. If I have 100+ accounts then I have to enter user name every time for all users. Is there anyway to restore all accounts?
     
  6. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    14,482
    Likes Received:
    203
    Trophy Points:
    63
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    You can restore multiple backups by using the following option available in Web Host Manager:

    "WHM >> Backup >> Restore Multiple Backups"

    If you are attempting to restore incremental backups, ensure the "Incremental Backup" option is enabled via "WHM >> Backup >> Configure Backup".

    Thank you.
     
  8. jamshed_11946

    jamshed_11946 Registered

    Joined:
    Aug 19, 2010
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    No one is understanding me.
    I did following
    1) Took remote backups of 50+ accounts from other server to my server.
    2) These backups were stored in a cpanel account and I moved all accounts to /home dir by using mv command
    3) No I go to Main >> Backup >> Restore a Full Backup/cpmove file and there were 50 accounts that can be restored.
    4) Through this method, I have to enter user name 50 times that is time consuming.
    5) Now my question is this that is there any shell command so that I can restore all these accounts from /home dir at once?
     
  9. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    Is there a reason you did not try the option Michael indicated:

    WHM >> Backup >> Restore Multiple Backups

    This would have allowed you to restore multiple backups rather than individually. The option you selected of "Restore a Full Backup/cpmove file" is not the same one he had noted.

    As for command line, you could do the following to restore multiple backups there.

    1. Create a list of all the usernames that are being restored called /root/acctlist. You could create this script by going to the old machine and doing this command:

    Code:
    cat /etc/trueuserdomains | cut -d: -d' ' -f2- > /root/acctlist
    This will create a file on the old machine /root/acctlist that you can copy to the new machine.

    2. On the new machine, you could then issue these commands after the new machine has /root/acctlist on it:

    Code:
    screen
    for i in `cat /root/acctlist` ;do /scripts/restorepkg $i ;done
    I have the command running in screen in case your SSH connection gets shut down somehow, since the screen session isn't dependent on your specific terminal working.

    If you don't have screen installed onto the new machine, you can install it using:

    Code:
    yum install screen
     
  10. jamshed_11946

    jamshed_11946 Registered

    Joined:
    Aug 19, 2010
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    I tried this option too but SSH timed out. Don't know what's the problem behind this?
     
  11. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    I don't understand why SSH would time out when this is a restore option and not a transfer option. When you are restoring backups that exist on the machine, it isn't using SSH.
     
  12. jamshed_11946

    jamshed_11946 Registered

    Joined:
    Aug 19, 2010
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Seems that you did not read the above replies carefully. I also tried to Transfer accounts and got SSH error.
     
  13. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    I am not referring to your prior replies but to the one that was directly above my reply since we were referring to my post. As such, I was referring directly to the fact you have the backups on the machine and tried to restore them using Main >> Backup >> Restore a Full Backup/cpmove file option. I asked if you had tried the method Michael suggested for those backups you had on the machine of WHM >> Backup >> Restore Multiple Backups, which you quoted in that reply. Under that method, SSH is not used when the backups already exist on the machine.

    I am trying to assist you here in your request for what to run in command line if you have backups on the machine. I am uncertain where Transfers comes into play under any of the methods I discussed in my post other than trying to copy the /root/acctlist file itself from the old server using scp. If you cannot copy that file using scp to get it onto the new machine, you can always open the file and copy the contents, then paste them into a new file on the new machine.

    Please feel free to provide specific details on anything that does not work using the method I actually suggested.
     
Loading...

Share This Page