Do you have multiple servers? Then it may happen that you want to copy files from one server to another server. To do this properly, we use the tool rsync. We are happy to explain to you how you can use this to copy files.
Copying RSYNC files
There are 2 methods you can use Rsync to copy your files, namely push and pull.
The Pull Method
With the pull method you want to download all files and directories from another server (for example a development server) to your HPW server. What exactly is an HPW server you can read here. You can use rsync on it as follows:
- rsync -avz webmaster@ontwikkel-server.ext:/var/www/html* /var/hpwsites/<u_gebruiker>/website/html/webroot/
The above example assumes that:
- webmaster the account is on the other server where you can access your website files
- develop-server.ext is the hostname of the other server
- all website files are located in the directory /var/www/html
- You replace <user> with the username of your HPW server
The values given in the example above are applicable for the given example. You should adjust these to the correct values for you. If you do not know which values are correct for you, you can contact our hosting experts. They will be happy to look with you.
The Push method
The push method can be recognized by the fact that you upload files to another server, from your HPW server. The difference in these methods is that with the pull method you download files to your hpw server and that you upload files with the push method.
For the push method it is important that 'the other server' is in possession of rsync. In addition, there must be an exception in the firewall of your HPW server.
To copy all files and directories from the current directory to the webroot you can do the following on the other server (not the HPW server):
</span>
<pre>rsync -avz ./* -e "ssh -p 22622" <user>@d-xxxxxxx.host-ed.eu:/var/hpwsi