Introduction

Restorepkg is the command-line utility used to restore cPanel backups. This script allows you to restore cPanel backups without logging into WHM.

 

Procedure

Restorepkg can restore a WHM-generated backup using either a username or a path to a backup file. This script must be run as the root user via the command line. The script can simply accept a file path:

/scripts/restorepkg /path/to/uploaded/backup/file/cpmove-$CPANELUSER.tar.gz

Or, if a username is provided:

/scripts/restorepkg $CPANELUSER

a cPanel-generated backup must be located in one of the following directories:

  • /home
  • /home2
  • /home3
  • /root
  • /usr
  • /usr/home
  • /web

Restorepkg will search the directories listed above for files matching the following patterns:

  • cpmove-{USER}
  • cpmove-{USER}.tar
  • cpmove-{USER}.tar.gz
  • {USER}.tar
  • {USER}.tar.gz
  • backup-{MM.DD.YYYY}{HH-MM-SS}{USER}.tar
  • backup-{MM.DD.YYYY}{HH-MM-SS}{USER}.tar.gz

Additional information regarding this script can be found in the WHM documentation:

The restorepkg Script