How to ensure changes get propagated before shutdown?

I have many devices running Syncthing, mostly all sharing the same folders.

My problem is that, despite having inotify enabled and fsWatcherDelayS=“1”, sometimes I change a file right before shutting down a computer, so the change is not picked up and propagated to the other devices, leading to problems, conflicts etc.

Now, I could open the web gui to check, but I’d prefer to simply write a script that waits for the changes to be propagated before shutting down. Alternatively, having something like a shell script or tray icon that informs me of when the changes have been propagated would work.

I’ve looked into the API (and use some API calls in my scripts), but understanding if changes have been propagated to other devices seems harder, i.e. not baked in the API but something I should build by parsing log messages.

Any suggestions?

Thanks in advance!

Remote completion status is available via the API, otherwise the UI would not be able to display it.

It’s definitely there, I suggest you check the docs again.

Wonderful, thank you! I really don’t know why I insisted on parsing FolderCompletion events.

Now, if I am interested in having each folder propagated to at least one device, would it be correct to:

  • get the list of devices (GET rest/system/config)
  • prune it to only online devices (GET rest/system/connections)
  • get the list of folders (GET rest/system/config)
  • for each folder, GET /rest/db/completion for each device until one is completed

Or do you have an idea which is smarter than mine (again)?

Thanks again