UPDATE: The one-liner below still works as of 7/23/15 on CENTOS 5.8 x86_64 WHM 11.50.0 (build 27). Will be testing shortly on CENT7
To create all accounts backup on your server, execute following command
for backup in `\ls /var/cpanel/users/`; do echo /scripts/pkgacct $backup; done
Run it the first time to see what it is going to do and then run it a second time and remove the echo command from it
for backup in `\ls /var/cpanel/users/`; do /scripts/pkgacct $backup; done
again you will find all accounts backed up under /home named cpmove-cpaneluser*.tar.gz
SCP Backups to New Server
After creating backup you have to transfer all accounts backup to your new server i.e Server B using SCP.
scp cpmove-* root@172.120.0.1:/home
Be sure all backups should move to /home directory of new server.
If you have done all accounts backup then you should have to move /var/cpanel/users file for restore on new server i.e Server B in /home directory with name user.txt
scp /var/cpanel/users root@172.120.0.1:/home/user.txt
Restore Backup
To restore single account backup execute following command.
/scripts/restorepkg cpaneluser
where cpaneluser is of old server and can be found on backup filename after cpmove. i.e
cpmove-cpaneluser*.tar.gz
To restore all accounts
for restore in `\cat /home/user.txt`; do echo /scripts/restorepkg $restore; done
Now you can List Account in WHM to see all accounts are transferred successfully to your new server and you can login to cpanel accounts of user using same Cpanel user / pass as old server.
Also for all accounts;
[root@host.mydomain.com] >> /scripts/cpbackup
[cpbackup] Process started in background.
[cpbackup] Log file: /usr/local/cpanel/logs/cpbackup/1286038243.log
0 Comments