Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

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 (v.2)

Discussion in 'Data Protection' started by postcd, Aug 29, 2017.

Tags:
  1. postcd

    postcd Well-Known Member

    Joined:
    Oct 22, 2010
    Messages:
    662
    Likes Received:
    11
    Trophy Points:
    68
    Hello,

    before a few years it was advised to restore multiple/all cpanel full backups at once at "WHM >> Backup >> Restore Multiple Backups", but such section is no longer there and in current Backup restoration sections i am unable to find the way to select all backups for that particular day be restored. In my case incremental backups. Thank you
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    15,681
    Likes Received:
    299
    Trophy Points:
    433
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
  3. postcd

    postcd Well-Known Member

    Joined:
    Oct 22, 2010
    Messages:
    662
    Likes Received:
    11
    Trophy Points:
    68
    Are You aware that i need to restore backups, not transfer current state of the cpanel accounts? I was unable to find that in the Transfer tool and in Backup Restoration sections. Where exactly it is that i can select which day backups to transfer&restore from old to new server (or from new server /backup dir) please and how to select ALL accounts not one by one doing 600+clicks?
     
    #3 postcd, Aug 29, 2017
    Last edited: Aug 30, 2017
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,220
    Likes Received:
    1,376
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    This is documented at:

    Restore Multiple Backups

    Thus, if you wanted to restore all backups from 08-31-2017 from the daily accounts backup directory, you'd use this command:

    Code:
    RESTORE_FROM_DATE="2017-08-31"; BACKUP_TYPE="daily"; if [ $BACKUP_TYPE="daily" ]; then BACKUP_BASE="/backup/$RESTORE_FROM_DATE/accounts/"; else BACKUP_BASE="/backup/$BACKUP_TYPE/"$RESTORE_FROM_DATE"/accounts/"; fi; for CP_ACC in $(find "$BACKUP_BASE" -type f -name '*.tar.gz' |awk -F/ '{print $5}' |sed 's/.tar.gz//g'); do /usr/local/cpanel/bin/backup_restore_manager add user="$CP_ACC" restore_point="$RESTORE_FROM_DATE" mail_config=1 mysql=1 subdomains=1; done
    This will queue a restore for all backups in /backup/2017-08-31/accounts/. Simply update 08-31-2017 in the above command with the date associated with the backup directory you want to restore all accounts from. Then, browse to "WHM Home » Backup » Backup Restoration" and click on the "Restore" button at the bottom to begin restoring the queued backups.

    Thank you.
     
  5. abdelhost77

    abdelhost77 Well-Known Member

    Joined:
    Apr 25, 2012
    Messages:
    89
    Likes Received:
    1
    Trophy Points:
    58
    cPanel Access Level:
    Root Administrator
    Hello ,

    unfortunately this do not work for me , only the first account is selectionned ( see below output)



    RESTORE_FROM_DATE="2017-09-19"; BACKUP_TYPE="daily"; if [ $BACKUP_TYPE="daily" ]; then BACKUP_BASE="/backup/$RESTORE_FROM_DATE/accounts/"; else BACKUP_BASE="/backup/$BACKUP_TYPE/"$RESTORE_FROM_DATE"/accounts/"; fi; for CP_ACC in $(find "$BACKUP_BASE" -type f -name '*.tar.gz' |awk -F/ '{print $5}' |sed 's/.tar.gz//g'); do /usr/local/cpanel/bin/backup_restore_manager add user="$CP_ACC" restore_point="$RESTORE_FROM_DATE" mail_config=1 mysql=1 subdomains=1; done


    info [backup_restore_manager] looking for /backup/2017-09-19/accounts/ananit/homedir
    response:id=TQ:TaskQueue:7
    reason = OK
    result = 1
    [root@h10 accounts]#
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,220
    Likes Received:
    1,376
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    For incremental backups, you'd need to update the command to look like this:

    Code:
    RESTORE_FROM_DATE="2017-09-19"; BACKUP_TYPE="daily"; if [ $BACKUP_TYPE="daily" ]; then BACKUP_BASE="/backup/$RESTORE_FROM_DATE/accounts/"; else BACKUP_BASE="/backup/$BACKUP_TYPE/"$RESTORE_FROM_DATE"/accounts/"; fi; for CP_ACC in $(find "$BACKUP_BASE" -maxdepth 1 -type d |awk -F/ '{print $5}' |sed 's/.tar.gz//g') ; do /usr/local/cpanel/bin/backup_restore_manager add user="$CP_ACC" restore_point="$RESTORE_FROM_DATE" mail_config=1 mysql=1 subdomains=1; done
    Thank you.
     
Loading...

Share This Page