Restore multiple accounts from new backups, by first letter?

lutronik

Member
Jul 15, 2003
11
1
153
Hello,


Please, I know it's possible to restore multiple backups by date:

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

But is it possible to restore by group of initial letters?

a*
b*
c*
....
?

I want to restore the accounts in batches, to make my work easier ... but I do not know if it's possible to do this.


Thank You,
Luiz Passarelli
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,213
363
Hello Luiz,

You could update the entry for "*.tar.gz" to "a*.tar.gz" in the command. For example:

Code:
RESTORE_FROM_DATE="2018-04-30"; 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 'a*.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 would queue the backup archives starting with the letter "a".

Thank you.