rsync is powerful and easy to use utility to keep files in sync between two servers. The principal way of rsync‘s command structure is to push files from point A to point B.
A Basic Example of an
rsync -vzru /home/location_A/ firstname.lastname@example.org:/home/location_B/
In the command above, files from
on a local disk and server is `pushed` to
The flags means the following:
is really useful because it means all directories and subdirectories will be copied.
means that it won’t copy files again which are the same as the destination receiver
Rsync Example with Custom SSH Port and Preserve Directory Permissions and Attributes
rsync -vrzua -e 'ssh -p 34229' /home/location_A/ email@example.com:/home/location_B/
In the above example, two additional flags were added, namely
. These means:
switch is extremely useful as it will copy all the attributes, e.g. directory permissions and so on.
in Real Time
commands are stored in a
to run every XX minutes.
If you want continuous
, and you are well aware of what it’s going to do to your network traffic, then you need to use an utility called
because running one
if the previous one hasn’t completed will cause problems.
Here is an example of the flock command: