Syncing User Filesystems Between Two Cpanel Servers

After doing a WHM multi-account copy, you may want to refresh the users home directories (including email and web files). This one liner uses rsync over SSH to do a quick sync of only changed files, emails, and website files. Run these commands on the NEW server.

First you need to create a list of domains in a text file ‘domains.txt’. Replace 1.2.3.4 with the remote hostname or IP.

while read i ; do rsync -aHxv root@1.2.3.4:/home/$(/scripts/whoowns $i)/ /home/$(/scripts/whoowns $i) ; done < domains.txt

Alternatively, you can use a list of users instead of domain names (use this method if there are multiple domains per user):

while read i ; do rsync -aHxv root@1.2.3.4:/home/$i/ /home/$i ; done < users.txt
Categories: Uncategorized. Bookmark the permalink. Comments Off on Syncing User Filesystems Between Two Cpanel Servers

Comments are closed.