

- #LINUX FILE SYNCHRONIZATION DAEMON HOW TO#
- #LINUX FILE SYNCHRONIZATION DAEMON INSTALL#
- #LINUX FILE SYNCHRONIZATION DAEMON MANUAL#
In other words, it can take a source directory and make an identical destination directory. Some users mistakenly think of rsync as a file copying tool, like cp or scp.While there’s some overlap, rsync excels in synchronization, specifically. It’s built into nearly every Linux system by default and this tutorial will help you to understand rsync better by providing you most common rsync examples administrators use to keep the data synchronised across multiple server/hosts. Verify that the file no longer exists on the target computer.Rsync stands for “remote sync” and is a powerful command line utility for synchronizing directories either on a local system or with remote machines. Delete the file we just created on the source computer: If so, the next step is to check the deletion process. Then verify that the target computer receives the new file. Check to be sure this is the case.Īssuming all of that worked out as we hoped, go ahead and create a new file on the source machine in your home directory:

If all is well, you should get a completely synchronized copy of your home directory on the target machine.

If it exists, you may want to back it up before executing the script! In this case, we assume that your home directory does not exist on the target machine. Also remember that in this example, the script is created on the "target" computer, because the file is pulled from the source computer: Replace it with the domain or IP address of your own source computer, both will work. Please note that the URL used below is "". Now, scripting makes it super simple and safe so that you can test it fearlessly. To create the file, just use this command:Ĭhmod +x /usr/local/sbin/rsync_dirs Testing ¶ Next, we need to set up a script by creating a file for it (again, use your favorite editor if you are not familiar with vi).
#LINUX FILE SYNCHRONIZATION DAEMON MANUAL#
There are many possibilities, so take a look at the manual for rsync. rsync Parameters And Setting Up A Script ¶īefore we get terribly carried away with setting up a script, we first need to decide what parameters we want to use with rsync. Once the SSH key pair has been created and password-free access from the target computer to the source computer has been confirmed, you can start.

This particular example will use rsync on the target machine to pull from the source instead of pushing from the source to the target, so you need to set up an SSH key pair for this.
#LINUX FILE SYNCHRONIZATION DAEMON INSTALL#
If the package is not installed, dnf will ask you to confirm the installation, if it is already installed, dnf will look for an update and prompt to install it. To ensure that rsync is installed and up to date, do the following on both computers: Installing rsync ¶Īlthough rsync may already be installed, it is best to update rsync to the latest version on the source and target computers. If you need to keep a set of directories on the target computer up to date, and you don't care about real-time synchronization as a feature, then rsync over SSH is probably the best solution.įor all of the below, we will be doing things as the root user, so either login as root or use the sudo -s command to switch to the root user in your terminal. However, it does provide the ability to keep two computers up to date on a schedule that you define. Using rsync over SSH is neither as powerful as lsyncd (which allows you to watch a directory or file for changes and keep it synchronized in real time), or as flexible as rsnapshot (which offers the ability to easily backup multiple targets from a single machine). Able to use crontab to automate the running of the script.Able to create a simple bash script, using vi or your favorite editor, and test it.You will need root access, and ideally be signed in as the root user in your terminal.
#LINUX FILE SYNCHRONIZATION DAEMON HOW TO#
