Sync only on scheduled time hours

Hi, is there a way to sync only on certain hours of the day?

i.e. from 9 pm 'til midnight.

Thanks

On Linux, etc. this is easy with cron. With Windows you can use Scheduled tasks to do the same thing.

$ crontab -e
0 21 0 0 0 ~/bin/syncthing/syncthing &
59 23 0 0 0 killall syncthing
2 Likes

With the soon to be implemented “pause repo” feature and syncthing-cli, this can hopefully be done a little bit cleaner soon.

This may not really guarantee sync since the size of the repo, connection etc might all vary by day, by repo etc. We need a way to confirm that the sync is done properly before signalling a kill.

curl http://127.0.0.1:8080/rest/model?repo=default, compare inSyncBytes with globalBytes and there you are.

Thanks, Windows Task Scheduler sounds like a good idea: i.e. “Start syncthing at 9pm”

@calmh the pause repo sounds great :smile:

:thumbsup:

Hi!

I am wondering if this should become a feature request (a low priority one). On one hand, it feels like it should. On the other hand, perhaps it’s too much work / complexity. Some ISPs offer unlimited data at off-peak hours, and some organizations may prefer to to sync / backups when folks are not working.

Cons:

  • Increases the odds of unresolved conflicts
  • There could be issues with various time zones
  • Adds complexity for a niche need.
  • Perhaps should be handled by external tools (ex: cron)

Pros:

  • Great for nighly backups
  • Reduce bandwidth cost & usage at peak hours

Thanks!

Possibly we could reboot the “pause repo” feature that has come, almost been merged, then dropped once or twice. If that’s in place, scheduling things is just a matter of sending the right commands from a scheduler, wrapper or whatever. (Or by all means doing it internally.)

Yes, it can do harm, but it’s to be used by those who understand how it works. So I’d be in favor of that :+1:

But yeah. It’d be useful.

Mine are atleast animated: http://devopsreactions.tumblr.com/post/39647530743/kill-9-1

Ok, great!

Another idea: to have different throttling speeds at different hours.

Thanks!