Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Restore multiple accounts from new backups, by first letter?

Discussion in 'Data Protection' started by lutronik, Apr 28, 2018.

  1. lutronik

    lutronik Member

    Joined:
    Jul 15, 2003
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    151
    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
     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,714
    Likes Received:
    1,883
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice