devops
devops

Reputation: 1201

lsyncd does not delete files at the reciever side

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?

Upvotes: 0

Views: 1356

Answers (2)

GuruRandapa
GuruRandapa

Reputation: 922

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

Upvotes: 0

axkibe
axkibe

Reputation: 2943

This is the designed behavior.

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

Upvotes: 0

Related Questions