You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like a command that blocks until the current folder is fully synchronized.
Why? I have a directory on my "local" machine with my data and my remote computer that I ssh into, which processes the data. Sometimes I make a small change to the data and want to process it. Let's say I process the data with make. Right now, if I make a small change locally and then immediately type in make, my remote server won't see the changes for several seconds, which means I don't know what I'm making.
So, instead of typing in make on my local server, I type in something like syncthing sync && make
syncthing sync immediately fails if all of my remotes are not connected
Then it makes sure that the synchronization is complete, which means that local and remote servers have detected and transferred all changes
syncthing exits (no error code), which means that the files match the remote files.
make is now sure to complete properly
There are no alternatives other than waiting, and there's no way to know how long to wait.
I write this like "syncthing sync" verifies that all files are synced the syncthing folder that $PWD is contained in, it could alternately be all syncthing folders that are "mounted" on the local machine.
Reacted by Matteo Carotta, Tobias Cudnik, Adam C. Stephens, Ravi van Rooijen, GalaxySnail, Lowell Alleman, jakobhec, Andrew Chadwick and strager
This can be determined via the API, so it could be done in an external script. It could also be done by something like syncthing cli await-insync now that we have the CLI integration.
I would like this feature in core syncthing too. My use case is a little Lakka box that I set up to sync game state files. A physical switch shutdown that interrupts the game will make Lakka's RetroArch autosave the game state locally, which then may or may not trigger a Syncthing sync (during shutdown, eek). It would be nice to wait for the autosave file to propagate out to my cloud in a systemd service's ExecStop before issuing a syncthing cli operations shutdown, say.
Martchus/syncthingtray's syncthingctl command already does something like this, and has obviously considered some edge cases. There's no mention of syncthing cli operations shutdown doing this.
$ syncthingctl --help
[...]
wait-for-idle, -w
waits until the specified dirs/devs are idling
note: Directories are considered idling if they are locally up-to-date and NOT otherwise
busy with e.g. scanning. Devices are considered idling if they are disconnected or all d
irectories shared with the device are remotely up-to-date.
--dir, -d [ID]
specifies a folder by ID
--dev [ID/name]
specifies a device by ID or name
--all-dirs
applies the operation for all folders
--all-devs
applies the operation for all devices
--at-least, -a [number]
specifies for how many milliseconds Syncthing must idle (prevents exiting too early in
case of flaky status)
--timeout, -t [number]
specifies how many milliseconds to wait at most
--require-devs-connected
requires all specified devices to be connected (by default disconnected devices are co
nsidered idling)
example: syncthingctl wait-for-idle --timeout 1800000 --at-least 5000 --all-devs --all-d
irs && systemctl poweroff
syncthingctl wait-for-idle --dir dir1 --dir dir2 --dev dev1 --dev dev2 --at-lea
st 5000
[...]
Activity
[-]A command to block on sync[/-][+]A command to wait for sync[/+]calmh commentedon Jul 24, 2021
This can be determined via the API, so it could be done in an external script. It could also be done by something like
syncthing cli await-insyncnow that we have the CLI integration.achadwick commentedon Sep 7, 2025
I would like this feature in core syncthing too. My use case is a little Lakka box that I set up to sync game state files. A physical switch shutdown that interrupts the game will make Lakka's RetroArch autosave the game state locally, which then may or may not trigger a Syncthing sync (during shutdown, eek). It would be nice to wait for the autosave file to propagate out to my cloud in a systemd service's
ExecStopbefore issuing asyncthing cli operations shutdown, say.Martchus/syncthingtray's
syncthingctlcommand already does something like this, and has obviously considered some edge cases. There's no mention ofsyncthing cli operations shutdowndoing this.