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 with the remote hostname or IP.

while read i ; do rsync -aHxv root@$(/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@$i/ /home/$i ; done < users.txt

No Comments.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Anti-Spam Quiz: