Sync some mode: run until in sync or run N minutes?

I’m enjoying syncthing and using it in a few use cases. Thanks!

I got to thinking it would be nice to sync to a machine where I have a shared account, but where it is inappropriate to leave a process running 24/7.

So I thought: No problem, I’ll just ssh in (or run a crontab); and run syncthing for “once.”

Not sure that the concept of “once” is a first class citizen in the current design.

Maybe I could cobble together something using the API to know when the synchronization has completed. Or maybe just something that lets it run for N minutes an hour and then shuts it down.

Maybe I’m proposing a feature?

So? Does it even make sense to “run it once” and if so is there a trick for doing that.

Hey there,

a similar question has been asked here . @StartledPhoenix seems to have achieved what you’re looking for.

Yeah, he polls the api waiting for a 10 minute period when the list of files needed is zero.

Today I was thinking that the event api might be the way to go. My scenario is a bit different since syncthing would be launched when I start the “one run”, so I probably need to wait for it to connect to some devices, watch the transfer progress, etc. But not too different.

I can’t tell if a “get into sync and then exit (or timeout)” feature would be a good feature addition or not.

I’ve actually considered it, but it’s tricky. Say Syncthing starts up, connects to one out of three devices, and is in sync with that one. Are we done and can exit?

An explicit --sync-with <device name> could be the easy way out here.

That answers my question then. The idea makes some sense, it’s sort of possible with the API, and yeah it might make an useful feature.

My initial reaction was: “Ought that not be –sync-once-with |all.” But that lead to …

Yeah, it’s a bit tangled if you have N partner devices and the folders are scattered over those partners. Might argue that the configuration is what it is. So one time means sync all the folders with all the partner devices or timeout. I.e. –sync-once-with-timeout <seconds>

Might be a role for args that narrow the configuration to a particular device of folder even for 24/7 syncing.

I’d very much appreciate such an option. One important use case for me is to keep some folders on my phone and my laptop in sync. Such an option would be ideal for that since I want to turn of WLAN on my phone once syncthing is done.