Monday, September 26, 2011

Full site backup and restore in Shell

September 8, 2010 by  
Filed under cPanel


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

GD Star Rating
Full site backup and restore in Shell, 10.0 out of 10 based on 2 ratings
Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)

Related posts:

  1. Cleaning backups of unused domains
  2. Error from park wrapper: is already configured
  3. Installing PostgreSQL on cPanel/WHM Server
  4. Installing PostgreSQL on cPanel Server
  5. Upload site content via the cPanel’s File Manager


2 Responses to “Full site backup and restore in Shell”
  1. vita74 says:

    How to Backup your Blog in the cPanel – – )

    GD Star Rating
  2. student grants says:

    Great, I never knew this, thanks.

    GD Star Rating

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!
Click here to cancel reply.