lsyncd does not delete files at the reciever side

1k Views Asked by At

I have successfully gotten lsyncd to work between two RHEL servers. Everything works great with 1 single exception.

My expectation that is confirmed by documentation is that if the file doesn't exist on the destination, it will be deleted. What is happening is that the only time files that exist on the destination and not in the source are deleted is if I restart the lsyncd service. Is that an expected behavior, or am I missing something?

2

There are 2 best solutions below

1
On

This is the designed behavior.

Lsyncd is coded to keep the destination synchronous to the source assuming nobody else messes around with the destination.

0
On

I know I am a bit late to the party, but to not delete files on the destination that is not present on the source. You can now add delete = false argument inside sync {} block in the lua file.

So, the lsyncd.conf.lua file will look like following

sync {
    ...
    delete = false
}

I found it from the changelog of the lsyncd. https://github.com/lsyncd/lsyncd/blob/e1e13503b292080992bbc6d9ad959b7e6d1bd7c9/ChangeLog#L174