Sync all folders before system shutdown

I’m using Syncthing (on Linux mostly) with some folders watched by syncthing-inotify and some (big) folders which are only checked/polled every five minutes (300s).

If I change or add a file before shutting down the system in one of the non-watched folders, it’s very likely that the changes won’t be detected in time.

So I was thinking if there is a way to delay the system shutdown, trigger a scan of all folders and wait until all changes (if any) are propagated? Maybe a custom systemd job could be used for this?

That should be possible by writing a shell script that uses the Rest API to trigger a scan and wait for the appropriate events. I am not sure what event to look for to make sure all changes are finished sending, that might not be possible. Then create a systemd service that runs this script and make (or whatever it is really called) depend on it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.