Shutdown Syncthing on sync complete

So, my use case - Syncthing as a backup:) One Master, one Slave. Master is my laptop, Slave is my NAS. I’d like Syncthing to shutdown on master once slave is in sync. This is purely to allow NAS to hibernate. Is this possible? I understand that what I’m doing is more of a on-demand sync, but that’s my use case;) To explain - I’d like to start syncthing manually on master just before I finish at work and as soon as Slave catches up it is ok to shutdown master and allow NAS to hibernate.

Any help would be appreciated.

You can potentially write something external that gets run by cron that polls the completion status via rest api and kills it.

The question is, who will restart it?

Well, I can’t really write anything;) so I’d have to hope that someone does it if this feature becomes useful for others. Regarding restart, I will restart it manually. As I said, I use on-demand sync, not non stop sync. I have physical access to both master and slave. I just think that such a feature might be useful. There are many programs that have a tick box “shutdown when complete” :wink: so why not Syncthing?

Because thats not what it does. Use cron and rsync if you want unidirectional one off sync. Syncthing is an overkill for what you are trying to achieve.

1 Like

Hm, master has windows OS, I don’t think there is cron and rsync. I actually like Syncthing very much and it does the job much better than other tools I’ve tried.

Unison works in Windows, iirc

Unison is no longer active project

Windows has it’s own scheduling framework which can be used instead of cron, also, the fact that unison is not active does not mean it’s not usable.

I don’t know why people get so hung up on whether a project is being actively developed. A mature project which is not actively developed is still going to have more features and fewer bugs than one which is still on beta but is actively developed.


In sure it has fewer bugs than Syncthing. :slight_smile:

Well, be it as it may, I’m not leaving Syncthing :wink: It has and does almost all I need and like. For example - unity seems like a CLI only. I’m too old (and lazy…ok, more lazy) to script. It might not work behind FW. Ok, I could VPN or tunnel, but again, too much hassle. In Syncthing I do a few clicks and everything works. Maybe there is another product out there that does the same job better, but I haven’t found one yet. Or maybe you just have a very good marketing :smiley: Having a option to shutdown after sync would be nice, but I’m not going to abandon Syncthing if that feature won’t make it :wink:

I’ve got one more question. In the spirit of education, do you guys know if there is a tool that does:

  • bidirectional sync
  • support master/slave
  • encrypted data transfer
  • no third party cloud data transfer/storage
  • “connect from anywhere” - so no problems with firewalls
  • can handle and is robust enough for say 400k files and 2TB size
  • has GUI
  • runs native on Windows OS and Synology NAS
  • can be scheduled to start/stop :wink:

I guess you know a lot more what’s on the market than I, so if there’s any better/more appropriate sync tool that would fit my use case you happen to know, it would be really appreciated if you could share that with me;)

These two are pretty much mutually exclusive. If you’ve got firewalls preventing incoming connections, you need a third-party service to relay that data.

Fair point. At least if the transfer is encrypted and not stored on relay servers, that’s still ok. My point is - I don’t think there is a better tool than Syncthing, or is there one? :wink:

Does the connection to your laptop really prevent your NAS to hibernate as there are also other connections made my syncthing (relay server, discovery)? Also what kind of hibernate are you talking about? Disk spinned down and the NAS itself running? That should work as long as the connection is stable, only a reconnect may wake up the disk, it did before delta index (see #2497), did not check what happens now…

I haven’t really investigated that too much but when laptop Syncthing is down, NAS will go to sleep after (I think) 30 mins of disk and network inactivity. So by hibernation I mean the system really goes to sleep. When I keep active Syncthing connection, laptop-To-NAS, that seems to prevent the system to sleep.

Well, I’m ready to give it a try with REST API, after reading docs I can’t see how to get remote device status. Any hints?

You can get the completion per device and folder:

@bedosk You’re not the only one with this use case that made the same conclusion about the tool. Plus I do have 1 folder that I do want to sync the way ‘Syncthing is meant to be’, so I couldn’t go for other suggested solutions (which indeed are way too much hassle for non-developers on Windows).

So, I’m very interested in if you reached a solution with the script already. This could help many others; I know several other users having the same need.

Let me know if I can help.