Hook to start another program on sync conflict

Hello everyone,

this is another feature request concerning notification about sync conflicts. I am aware of the other threads such as the ones I have quoted below. However, I’d like to propose a flexible approach:

I would like to have 2 features:

  1. In the config file, I would like to set a hook, meaning a path to an executable which is called whenever a sync conflict arises (once for each file). I would imagine that the following parameters should be handed over in the call:
  • 1. name of the file which caused the conflict
  • 2. name of the newly created “.sync-conflict…” file.
    1. local folder of the file which caused the conflict
  • 4.+5. names of the two machines the conflict was detected with.
  • Possibly there might be other useful parameter like “reason for conflict”, but I don’t know enough to judge that.
  1. This hook (if it is indeed set in the config file) should be called with the parameters described above whenever a sync conflict occurs. The hook should be called on all machines where the file in question is synced with. To this end, the machine where the conflict is detected should notify the other sync’ing machines about it.

In this way we are quite flexible about what to do about the conflicts. One can set up a user notification, or a log, or whatever. In my use case I run syncthing on a debian server and would use that to trigger an email to myself about it, maybe filtered for only some of the sync’ed folders.

What do you think about that? Is that feasable?

BTW: Thanks a lot for the great tool!


Here are the similar threads, FYI:

There is a fundamental difference between the device creating the conflict file and the ones receiving it. I’m not sure we have an API event for the former, but the latter simply see the conflict as a file addition with a name matching a certain pattern.

A useful addition would be an event for new conflict file creation.

Anything involving running arbitrary commands would better be solved by an external daemon listening to the Event API. That way, its could solve lots of different needs for calling hook scripts.

Thank you for your reply.

A daemon listening to the API may technically be the better solution. However, I don’t have the techical knowledge to build such a daemon. What I could manage would be to write a bash script, hence my request for a solution where I could simply set the path to such a script in the config file. But maybe there could be a general daemon which could be configured to trigger scripts on ceratain events.

Whatever the solution my be in the end, what do i have to do to make this a proper feature request which may be implemented?

Write a script to look for conflict files and let you know? And use cron to run it periodically?