cPanel – All Account Migration

Set of simple Scripts which will simplify your cPanel account migration when transfer tool in WHM is not helping you:
1) We need to get the list of user accounts first.
cat /etc/userdomains | cut -d”:” -f2 | grep -v nobody | sort -n| uniq >> user.txt
This will generate the cpanel usernames in your server and write it into a file called user.txt

2) Now run the backup script:
for user in `\cat user.txt`; do /scripts/pkgacct $user; done
This will run pkgacct script for every cpanel user and store the backup in /home directory.

3) Now you need to send them over to destination server.
scp /home/cpmove-* root@destination-server-IP:/home
SCP is SSH copy command so if your destination server is having some other SSH port use the below command to work out:
scp -P Portnumber  /home/cpmove-* root@destination-server-IP:/home
This commands will copy the backup files over to the destination server.

4) You have one more thing to send it to the destination server, the User account list. Either you can copy paste the contents over to the remote server or SCP it as well over to the remote server using the command below:
scp user.txt root@DestiantionserverIP:/home/
The below command if your destination server is having different SSH port.
scp -P Portnumber  user.txt root@destination-server-IP:/home/

5) Now time to restore the Backups in the destination server. SSH into Destination server. You can find the copied backups under home directory. To restore them one by one use :
/scripts/restorepkg cpaneluser

6) To restore them all at once, use the the command below:
for restore in `\cat /home/user.txt`; do echo /scripts/restorepkg $restore; done

Once the Process is finished, all is well. You have completed the Migration like a charm. Have a great Day…

Advertisements

3 thoughts on “cPanel – All Account Migration”

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s