Friday, March 22, 2013

Cpanel Backup & Recovery


Here’s the main command I use for Cpanel Backup, just type the following and change “accountname” to the cpanel user account name:
/scripts/pkgacct accountname

So there you have it, basic Cpanel Backup, -now it’s time to SFTP or SCP that thing somewhere off line for recovery purposes later.
scp /home/cpmove-yourdomain.tar.gz remote-hostname.com:/your/remote/backup/directory/name/

let’s say you have a lot of accounts, you can cat the /home directory and run a command on all of them using a variable.
To copy all cpanel accounts, just type:
ls /var/cpanel/users | while read x; do
/scripts/pkgacct $x
done
This will back up all cPanel accounts.  Expect it to take a while.

All the tar.gz backup packages will be located in /home directory.

ow you can move them out via SCP as discussed.

SCP Cpanel Backups to Remote Server:

To transfer the data across to the remote server, type:
scp cpmove-* root@10.20.30.40:/home

To restore an account in Cpanel, just type:
/scripts/restorepkg username
To restore all accounts:
ls /home/ | while read b; do
/scripts/restorepkg $b
done

No comments:

Post a Comment