Trigger File

Is there a way to make a folder pause if a particular trigger file does not exist? I occasionally have a problem where my server that I sync my music with has some of its storage offline when syncthing starts up and it wipes out the matching folders on my laptop. I would like to be able to tell the instances that if they don’t see a particular file (or list of files) then that folder should be paused.

Think of the instance being on a mergerfs disk that happens to be missing a part or two. It will think all of those file are gone temporarly.


One workaround is to place the .stfolder on the mergerfs volume or specify an alternate marker to possibly act as your “trigger”. When the mergerfs volume or alternate marker disappears, Syncthing will see that something is wrong and automatically pause the affected folder.

I have a somewhat unusual setup at work where the path for the Syncthing folder is to a tmpfs volume, so Syncthing’s .stfolder marker disappears whenever the server is rebooted.

I configured Apache HTTP Server to require a file in the tmpfs volume so that httpd fails to start after a system reboot (I don’t want or need users to access the website while the synced files are missing). There are multiple nodes in the Syncthing cluster, so the rebooted node can re-sync with its siblings before httpd is started back up (handled by a really simple shell script).

You can actually, by using a custom marker name (instead of .stfolder) that points to the file you want to always exist.

1 Like