Upgrade to certain version


supposing I want to upgrade syncthing to a certain version, which is not necessarily the latest, how can I do so?

I checked the list of console commands (by the way, is it comprehensive?), but no command seems to serve for my purpose.

Just download the version you want and disable automatic upgrades

So there is no command for this? It would be nice to write simple update scripts for a bunch of machines…

Please read the documentation,

./syncthing -h

will tell you about the option

STNOUPGRADE Disable automatic upgrades.

There is a misunderstanding, I did not ask for how to disable autmatic upgrades. :wink:

I asked for how to upgrade syncthing to a certain version by console, because I could not find such a command in the documentation. Therefore I asked, if the provided list of console commands is comprehensive.

-upgrade-to="" Force upgrade directly from specified URL


“Force upgrade directly from specified URL” does not sound to me like something that might allow me to chose a version.

Also, the documentation does not explain how to choose a certain version via an URL. Can you give me a syntax example?

I guess it works as follows:


but I’ve never used it…

Thank you for the example! I have’t tried it out yet, but if it works that way, it won’t be possible to update, for example, 32bit and 64bit versions using the same script, since the routine will not check for the currently used version and upgrade it, but will overwrite it with the version provided by the link.

I hoped, there would be something like “-upgrade-to vx.xx.xx” which works almost like the usual “upgrade”.

syncthing -version will tell you whether it is 32bit or 64bit, so it is possible to upgrade from same script.

Sorry if the answer to this question is obvious, but I’m not that familiar with batch files (currently testing on Win7): How do I get the return value of the “-version” command, so the script can make the decision for the right version on its own? Checking the errorlevel always gives 0, and there will be no user sitting in front of a screen, making the right decision based on any output given to him…

Sorry, I also hopeless here. I know how to do it in linux, but I would have to google a lot to figure this out for windows. But I’m certain that it is possible.

My first idea would be to redirect the output to a file and then read that file, like:

synthing -version > tmpFile
set /p myvar= < tmpFile
del tmpFile

There is also a (quite strange looking) possibility directly in batch:

What exactly is it you want to do? I.e. I understand you want to upgrade an installation to a certain version - but why? Do you want to upgrade it to the same as something else? To some officially blessed version?

The problem is a bit awkward:

I have a bunch of machines which are connected to each other via Syncthing. On some of the machines, Syncthing always fails to auto-update, since it lacks from some writing permission to rename the old executable (I don’t have access to these machines, so I can’t fix this). To update anyhow, I wrote a script which, in principle, does the job.

Now my problem is, that not all machines are running 24/7, so I might have updated one machine to 0.11.3, for example, but until another machine shows up again, 0.11.5 has been released, for example, and the other machines will upgrade to this version. Now, if the versions are not compatible, like from 0.10 to 0.11, the nodes will fail to connect until I started the next update cycle, which is about once per week.

So, if I could specify the version the other nodes should upgrade to, this will solve my problem, since homogeneity is more important for me here that beeing up to date.

I tried out the idea to read the return value of “-version”, but since the nodes I have to update are running different versions of Syncthing, it’s currently very expensive (in lines of code) to provide each system with the correct version.

I’m not sure you need all that engineering, except for the machine that can’t auto upgrade. Some mechanisms work to your advantage:

  • We never auto upgrade to an incompatible version. The v0.10 to v0.11 upgrade for example requires at minimum a button press.

  • Syncthing looks for an upgrade when a newer device connects. So in practice, a cluster with auto upgrade tends to upgrade all devices rather quickly once one device gets upgraded.

  • Syncthing looks for an upgrade at startup, so the machines that are not online 24/7 will tend to upgrade when they come online. If the rest of the cluster is behind, see point two above.

Although, it wouldn’t be rocket science to be able to run a local upgrade server; basically an HTTPS server providing a JSON file describing the “latest” version and then the packages themselves… It would need some small tweaks to make the upgrade server URL configurable and a tool to generate the JSON file as part of the release process.

This works indeed to my advantage, thank you for the explanation. However the idea of a local upgrade server is very nice, this seems to be even more work to me than the tweaks I’m currently doing via scripts. I will see what I can do, so far, again thank you all for your advice!