Recover multiple full backups in cpanel via cli

Today I decided to do some tests on a clean Cpanel installation for which I needed several users. Since I didn't want to burden the running servers with batch archiving and file transfer, I used the archives from the previous evening. I transferred all my archives to / home and found that Cpanel does not offer recovery anymore 1 account simultaneously through both GUI and CLI. Through GUI as there was no way to receive number I decided to outwit with cli the restorepkg script. Its use is infinitely simple

/scripts/restorepkg username.tar.gz

As the action is repeated for each user separately. When trying to use * instead of the username the script directly cut me off so it has to be approached a little more elegantly –

archives=$(ls /home/ | grep tar.gz)

for archive in $archives

do

/scripts/restorepkg --force $archive

done

Now a quick explanation. We make a list of all the archives and push it into the variable archives then go through the list item by item by starting the unpacking for each archive separately. Nobody knows how complicated and interesting why the guys from Cpanel did not use such a solution for many files.

Leave a Reply

Your email address will not be published. Required fields are marked *

Anti SPAM *