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-* [email protected]:/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 [email protected]:/home/user.txt
To restore single account backup execute following command.
where cpaneluser is of old server and can be found on backup filename after cpmove. i.e
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;
[[email protected]] >> /scripts/cpbackup
[cpbackup] Process started in background.
[cpbackup] Log file: /usr/local/cpanel/logs/cpbackup/1286038243.log