How can I restore multiple accounts from cPanel backups (v.2)
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
-
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? 0 -
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]# 0 -
Hello, For incremental backups, you'd need to update the command to look like this: 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.0 -
Why not just this (on target server): cd ~ scp root@10.5.0.175:/backup/2018-02-08/accounts/* . ls -1 *.tar.gz | sed -e 's/\.tar\.gz$//' | xargs /scripts/restorepkg --force (note: this doesn't work because xargs doesn't like it for some reason. I'm sure someone smarter than me can fix it, I couldn't figure it out, something with the delimiter, xargs would only run one restorepkg command, and the sed wasn't needed at all. In the meantime I just made a .sh with a bunch of restorepkg commands for each filename.) The "ls" line just uses sed to strip the .tar.gz from the filename and assumes what remains is the account name, which it should be, and pipes all these account names to restorepkg which seems nice. or, even better I discovered, just scp over the .tar.gz files then move them into /backups/2018-02-08/accounts and then use WHM >> Backups >> Backup Restoration which will then see all those files? Which is best? @cPanelMichael your command is pretty complex, I haven't unpacked that so maybe you can explain how that might be better than this simple method, and also let me know if there are any pitfalls with either of these. (Edit: for incrementals, multiple separate SCPs would be required to bring over the base backups and I don't know what other problems incrementals might introduce here.) 0 -
@cPanelMichael your command is pretty complex, I haven't unpacked that so maybe you can explain how that might be better than this simple method, and also let me know if there are any pitfalls with either of these.
Hi Erik, The command I provided utilizes the WHM >> Backup Restoration queue. Thus, you can then utilize Web Host Manager to proceed with the restore process to more easily follow the progress and see any errors that occur during the restoration process. Thank you.0
Please sign in to leave a comment.
Comments
7 comments