Restore 200+ fullbackup account on my WHM

al_bozorgi

Member
Nov 6, 2013
13
0
1
cPanel Access Level
Root Administrator
hi,

First sorry for my poor English.

i move 200+ (about 205 account) to my server location ==> /home.

all account generated by cpanel and name's equal "backup-{BACKUP-DATE_TIME}_{USER}.tar.gz".

i have Root access and i install cpanel two day age and no account create on it (fresh cpanel server)

my Question is : How can i Restore all account with one action ??

i know whm have option "Restore a Full Backup/cpmove File" but this option can restore one account in time for another account muse type user account this is not good and waste my time.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,261
463
Hello :)

You could try using a command like this to restore all accounts via SSH:

Code:
for i in `ls /home/*.tar.gz|cut -d \- -f 2 | cut -d . -f 1 `;do /scripts/restorepkg $i;done
Note that you may want to run this command in a "screen" session as it may take a while to complete.

Thank you.
 

al_bozorgi

Member
Nov 6, 2013
13
0
1
cPanel Access Level
Root Administrator
Thank you so much.

i change your script cat result is not return correct value of user name then i change for these script and work correctly :

for i in `ls /home/*.tar.gz|cut -f3 -d'_'|cut -f1 -d'.'`;do /scripts/restorepkg $i;done
Thank you again for fast replay and save my time.
 

regulararticles

Registered
Dec 5, 2010
4
0
51
Restore multiple backup in one command ssh
if the filename of the full backups varied, you could store a list of the full paths to each backup in a text file, such as a text file at "/root/list_of_backups.txt" and then the command could be altered as follows:

# for x in $(cat /root/list_of_backups.txt); do echo /scripts/restorepkg $x; done;