๐Ÿ“˜Restore Multiple cPanel Backups

This guide provides various methods to restore multiple cPanel account backups using WHM or command-line tools.


๐Ÿ” Restore a Single Account

Navigate to your backup folder and run:

cd /backup/accounts/2017-09-24
/scripts/restorepkg nameofuseraccount

๐Ÿงจ Force Restore (Overwrite Existing Account)

If the cPanel account already exists and you wish to overwrite it:

cd /backup/daily/accounts
/scripts/restorepkg --force nameofuseraccount

๐Ÿ”„ Restore All Compressed Accounts (Loop Through)

To restore all .tar.gz backups in a directory:

cd /backup/daily/2018-13-11/accounts
for archive in `ls`; do /scripts/restorepkg $archive; done

โš™๏ธ Restore Multiple Accounts via backup_restore_manager

๐Ÿ“Œ Important:

Make sure account backups are enabled in WHM:

WHM >> Backup >> Backup Configuration

Your backups should be located in:

/backup/YYYY-MM-DD/accounts/

Replace YYYY-MM-DD with the actual backup date.


๐Ÿ” Restore from Incremental Backups

RESTORE_FROM_DATE="2017-09-24"
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" -maxdepth 1 -type d | 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

๐Ÿ“ฆ Restore from Compressed Backups

RESTORE_FROM_DATE="2017-09-24"
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

โœ… Final Notes

  • Ensure that backups are in: /backup/2017-09-24/accounts/
  • Adjust RESTORE_FROM_DATE and paths accordingly.
  • Compressed backups typically end in .tar.gz
  • Use --force option if account already exists and must be overwritten.
Scroll to Top