Small script put together to restore all databases from cPanel backups, just put the path to the backup directory in backuppath, and the restoredir should be a directory on a partition with enough room to extract all of the backups.
#!/bin/bash
backuppath=""
restoredir=""
for bckp in $(\ls $backuppath/*.tar.gz);
do
noprfx=$(sed -e 's/\.tar\.gz//' <<< $bckp);
acctname=$(awk -F"/" '{print $NF}' <<< $noprfx);
tar xzvf $bckp -C $restoredir/ $acctname/mysql;
for creat in $(\ls $restoredir/$acctname/mysql/*.create);
do
echo "Creating $creat"
mysql < $creat;
done;
for dump in $(\ls $restoredir/$acctname/mysql/*.sql);
do
echo "Importing $dump"
dbname=$(awk -F"/" '{print $NF}' <<< $dump);
mysql $(sed -e 's/\.sql//' <<< $dbname) < $dump;
done ;
/usr/local/cpanel/bin/restoregrants --cpuser=$acctname --db=mysql --all;
done
Hello
Wonderful script.
You would have a version for incremental backups (no compression)
The inoodb1 file has been corrupted and I will do a new installation of MYSQL and then restore all bases so that inoodb is rebuilt.
Thank you !
MARCELO