REAL TIME REMOTE FILE SYNCHRONIZATION WITH LSYNCD
Just make the /etc/lsyncd.conf file look like this:
settings {
logfile = "/var/log/lsyncd/lsyncd.log",
statusFile = "/var/log/lsyncd/lsyncd-status.log",
statusInterval = 1,
nodaemon = true,
insist = true
}
sync {
default.rsync,
source = "/path/to/synced/dir",
target = "${SECOND_HOST}:/path/to/synced/dir", # (1)
delay = 1,
delete = 'running',
rsync = {
archive = true,
temp_dir = "/tmp",
update = true
}
}
(1) To achieve bidirectional synchronization, just set up a Lsync server in the second machine and change this to point to the first one