Full site backup and restore in Shell

September 8, 2010 • By admincPanel

You can generate full site backup from individual cPanel account. However, for some reason if you want  backup several sites (but not all sites) it is a bit tedious to switch to every cPanel account and generate backups. If you are in such a situation, you can take backups easily from shell. However, you must be root (or root privileged user)  to perform these tasks.

Generating a full site backup

Login to your server shell as root and run the following command:

# /scripts/pkgacct username

The username must be replaced by the specific username in server whose home directory you want to backup. This will generate a full site backup (including database, emails etc.) restore-able in any cPanel server using cPanel’s restore mechanism. Let’s assume it generated a backup and the filename is cpmove-testuser.tar.gz.


Restoring the generated backup

You can now easily restore these file from WHM->Backup->Restore a Full Backup/cpmove file section. However, our intention is to do it from shell. It is also simple. Simply run the following command:

# /scripts/restorepkg cpmove-testuser.tar.gz

cpmove-testuser.tar.gz is the file generated in previous step. For your case, replace you actual file created.

The command restorepkg provides same other options. Run /scripts/restorepkg to see its options! For example, if you want to skip restoring reseller privileges run the following command:

/scripts/restorepkg –skipres cpmove-testuser.tar.gz

Restoring Notes:

  1. This feature will restore full backups, cpanel backups and cpanel move files in the format of:cpmove-user.tar.gz, user.tar.gz, backup-date_time_user.tar.gz
  2. The files must be in one of these directories on the server:      /home, /home2, /home3, /root, /usr, /usr/home, /web

Full site backup and restore in Shell, 10.0 out of 10 based on 2 ratings