How to Sync Local and Remote Directories using LSyncd on CentOS 7

LSyncd is free and open source tool that is designed to synchronize a slowly changing local files and folders to a local or remote target. It is sync changes or modification in a file and directory to the remote or local destination in a specific time interval. This article describe How to Sync Local Directories using LSyncd on CentOS 7.   Step 1. Install Lsyncd package: Follow the article How to install lsyncd on CentOS 7 to install Lsyncd Package.   Step 2. Configuration Changes: Modify the LSyncd configuration file as shown below. Change the parameters according to the environment.  

[[email protected] ~]#     ……………………..     —     settings{logfile = “/var/log/lsyncd/lsyncd.log”,statusFile = “/var/log/lsyncd/lsyncd.status”}       sync{default.rsyncssh, source=”/source_data_folder/”, host = “target_host”, targetdir=”/target_folder/”}     [[email protected] ~]#    

Step 3. Starting Service: Run the following command to start the service and enable it for auto start across the machine reboot:  

[[email protected] ~]# systemctl start lsyncd     [[email protected] ~]#    
[[email protected] ~]# systemctl enable lsyncd     Created symlink from /etc/systemd/system/ to /usr/lib/systemd/system/lsyncd.service.     [[email protected] ~]#    

Step 4. Verify the Service Status: Run the following command to verify Service Status:  

[[email protected] ~]# systemctl status lsyncd     ● lsyncd.service – Live Syncing (Mirror) Daemon        Loaded: loaded (/usr/lib/systemd/system/lsyncd.service; enabled; vendor preset: disabled)          Active: active (running) since Mon 2020-02-10 22:16:40 IST; 4min 53s ago      Main PID: 3715 (lsyncd)        CGroup: /system.slice/lsyncd.service                └─3715 /usr/bin/lsyncd -nodaemon /etc/lsyncd.conf ……………………..     Feb 10 22:22:07 linuxcnf systemd[1]: Started Live Syncing (Mirror) Daemon.     [[email protected] ~]#    
[[email protected] ~]# systemctl is-enabled lsyncd     enabled     [[email protected] ~]#    

Done!!! Check the log files status (“/var/log/lsyncd/lsyncd.log” and “/var/log/lsyncd/lsyncd.status“).

Leave a Reply