# Upgrade to certain version

**URL:** https://forum.syncthing.net/t/upgrade-to-certain-version/2751
**Category:** General
**Created:** [May 16, 2015, 9:16am UTC](https://forum.syncthing.net/t/upgrade-to-certain-version/2751 "2015-05-16T09:16:38Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![Max](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/m/e5b9ba/32.png) [@Max](https://forum.syncthing.net/u/Max)
#### Post date: [May 16, 2015, 9:16am UTC](https://forum.syncthing.net/t/upgrade-to-certain-version/2751/1 "2015-05-16T09:16:38Z")

</div>

Hi,

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.

---

<div class="post-metadata">

### Author: ![AudriusButkevicius](https://forum.syncthing.net/user_avatar/forum.syncthing.net/audriusbutkevicius/32/277_2.png) [@AudriusButkevicius](https://forum.syncthing.net/u/AudriusButkevicius)
#### Post date: [May 16, 2015, 9:32am UTC](https://forum.syncthing.net/t/upgrade-to-certain-version/2751/2 "2015-05-16T09:32:30Z")

</div>

Just download the version you want and disable automatic upgrades

---

<div class="post-metadata">

### Author: ![Max](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/m/e5b9ba/32.png) [@Max](https://forum.syncthing.net/u/Max)
#### Post date: [May 16, 2015, 9:45am UTC](https://forum.syncthing.net/t/upgrade-to-certain-version/2751/3 "2015-05-16T09:45:35Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Zillode](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/z/c67d28/32.png) [@Zillode](https://forum.syncthing.net/u/Zillode)
#### Post date: [May 16, 2015, 10:57am UTC](https://forum.syncthing.net/t/upgrade-to-certain-version/2751/4 "2015-05-16T10:57:40Z")

</div>

Please read the documentation,

> ./syncthing -h

will tell you about the option

> STNOUPGRADE Disable automatic upgrades.

---

<div class="post-metadata">

### Author: ![Max](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/m/e5b9ba/32.png) [@Max](https://forum.syncthing.net/u/Max)
#### Post date: [May 16, 2015, 11:30am UTC](https://forum.syncthing.net/t/upgrade-to-certain-version/2751/5 "2015-05-16T11:30:32Z")

</div>

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

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.

---

<div class="post-metadata">

### Author: ![Zillode](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/z/c67d28/32.png) [@Zillode](https://forum.syncthing.net/u/Zillode)
#### Post date: [May 16, 2015, 11:51am UTC](https://forum.syncthing.net/t/upgrade-to-certain-version/2751/6 "2015-05-16T11:51:30Z")

</div>

> -upgrade-to=“” Force upgrade directly from specified URL

?

---

<div class="post-metadata">

### Author: ![Max](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/m/e5b9ba/32.png) [@Max](https://forum.syncthing.net/u/Max)
#### Post date: [May 16, 2015, 12:44pm UTC](https://forum.syncthing.net/t/upgrade-to-certain-version/2751/7 "2015-05-16T12:44:51Z")

</div>

“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?

---

<div class="post-metadata">

### Author: ![Zillode](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/z/c67d28/32.png) [@Zillode](https://forum.syncthing.net/u/Zillode)
#### Post date: [May 16, 2015, 1:56pm UTC](https://forum.syncthing.net/t/upgrade-to-certain-version/2751/8 "2015-05-16T13:56:28Z")

</div>

I guess it works as follows:

> -upgrade-to=“[https://github.com/syncthing/syncthing/releases/download/v0.11.5/syncthing-linux-amd64-v0.11.5.tar.gz](https://github.com/syncthing/syncthing/releases/download/v0.11.5/syncthing-linux-amd64-v0.11.5.tar.gz)”

but I’ve never used it…

---

<div class="post-metadata">

### Author: ![Max](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/m/e5b9ba/32.png) [@Max](https://forum.syncthing.net/u/Max)
#### Post date: [May 16, 2015, 3:38pm UTC](https://forum.syncthing.net/t/upgrade-to-certain-version/2751/9 "2015-05-16T15:38:17Z")

</div>

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”.

---

<div class="post-metadata">

### Author: ![chucic](https://forum.syncthing.net/user_avatar/forum.syncthing.net/chucic/32/4032_2.png) [@chucic](https://forum.syncthing.net/u/chucic)
#### Post date: [May 16, 2015, 4:13pm UTC](https://forum.syncthing.net/t/upgrade-to-certain-version/2751/10 "2015-05-16T16:13:59Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Max](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/m/e5b9ba/32.png) [@Max](https://forum.syncthing.net/u/Max)
#### Post date: [May 16, 2015, 5:04pm UTC](https://forum.syncthing.net/t/upgrade-to-certain-version/2751/11 "2015-05-16T17:04:20Z")

</div>

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…

---

<div class="post-metadata">

### Author: ![chucic](https://forum.syncthing.net/user_avatar/forum.syncthing.net/chucic/32/4032_2.png) [@chucic](https://forum.syncthing.net/u/chucic)
#### Post date: [May 16, 2015, 8:34pm UTC](https://forum.syncthing.net/t/upgrade-to-certain-version/2751/12 "2015-05-16T20:34:29Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![wweich](https://forum.syncthing.net/user_avatar/forum.syncthing.net/wweich/32/1063_2.png) [@wweich](https://forum.syncthing.net/u/wweich)
#### Post date: [May 16, 2015, 8:42pm UTC](https://forum.syncthing.net/t/upgrade-to-certain-version/2751/13 "2015-05-16T20:42:20Z")

</div>

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:

> <https://stackoverflow.com/questions/6359820/how-to-set-commands-output-as-a-variable-in-a-batch-file>

---

<div class="post-metadata">

### Author: ![calmh](https://forum.syncthing.net/user_avatar/forum.syncthing.net/calmh/32/15311_2.png) [@calmh](https://forum.syncthing.net/u/calmh)
#### Post date: [May 19, 2015, 8:00pm UTC](https://forum.syncthing.net/t/upgrade-to-certain-version/2751/14 "2015-05-19T20:00:18Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![Max](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/m/e5b9ba/32.png) [@Max](https://forum.syncthing.net/u/Max)
#### Post date: [May 19, 2015, 9:27pm UTC](https://forum.syncthing.net/t/upgrade-to-certain-version/2751/15 "2015-05-19T21:27:05Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![calmh](https://forum.syncthing.net/user_avatar/forum.syncthing.net/calmh/32/15311_2.png) [@calmh](https://forum.syncthing.net/u/calmh)
#### Post date: [May 19, 2015, 9:37pm UTC](https://forum.syncthing.net/t/upgrade-to-certain-version/2751/16 "2015-05-19T21:37:34Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Max](https://forum.syncthing.net/letter_avatar_proxy/v4/letter/m/e5b9ba/32.png) [@Max](https://forum.syncthing.net/u/Max)
#### Post date: [May 20, 2015, 5:52pm UTC](https://forum.syncthing.net/t/upgrade-to-certain-version/2751/17 "2015-05-20T17:52:27Z")

</div>

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!
