Lsyncd (Live Syncing Daemon) is a light-weight live mirror solution between two directories. It uses rsync and ssh. Custom configuration profiles can be written in the Lua language (see example below).
Lsyncd home page is available here. It is also available from a GitHub repository.
Setup
Setup on Debian/Ubuntu
sudo apt-get install lsyncd
Setup on Centos/RHEL
Setup on Archlinux
Available from the AUR repository. See here.
Example configuration
The following example describes a live syncing of the project “/data/projects/myproject
” (source) to “/store/backup/myproject
” (target) in a Debian/Ubuntu system. Some files are excluded (.git
, vendor
, etc).
As root
systemctl stop lsyncd.service
Create the following:
mkdir /etc/lsyncd
mkdir /var/log/lsyncd
touch /var/log/lsyncd/lsyncd.log
touch /var/log/lsyncd/lsyncd.status
Create the config file
nano /etc/lsyncd/lsyncd.conf.lua
Add the following:
settings {
logfile = "/var/log/lsyncd/lsyncd.log",
statusFile = "/var/log/lsyncd/lsyncd.status"
}
sync {
default.rsync,
source = "/data/projects/myproject",
target = "/store/backup/myproject",
exclude = {'.git/' , 'vendor/', 'web/node_modules', 'bundled/'},
rsync = {
archive = true,
compress = true
}
}
If you want to sync more than one directories, add more “sync” blocks.
Finally
systemctl start lsyncd.service
Combine with Dropbox
If the target directory is inside your Dropbox, you will have both a local and a cloud clone of the source directory.
Lsyncd alternatives
Entrepreneur | Full-stack developer | Founder of MediSign Ltd. I have over 15 years of professional experience designing and developing web applications. I am also very experienced in managing (web) projects.