pause sync timer?

Is there a chance that a timer might get added to the pause functionality? I like to pause syncthing when I’m on a bad internet connection but I often forget to turn it back on … (as I’m so used to it always being there for me!) I’d be great if one could e.g. set it to pause for N hours, N days…

Thanks for the great program!

That would certainly be technically possible. We just need a feature ticket on GitHub and someone to contribute the code for it.

In the meantime, you can use the REST API to pause all devices and use the scheduler of your system to unpause it after n hours / days / … .

Thanks for the fast feedback! - I very much like the idea to use the API and be able to write a short batch script for it - that would actually be the most convenient.

Never having done anything with REST (and not a lot of any programming in total…), I searched played around and came to the following command to pause:

curl -k --insecure -X POST -H X-API-Key:theapikeytakenfromthegui ‘https://127.0.0.1:8384/rest/system/pause

When executing this, I obtain no error, but also nothing happens (The gui-interface does not show it to be paused). To see if the overall post-syntax is OK, I tried the ping-post command and it seems to work… May I ask you to give me yet another hint?

Thanks a lot in advance!

This works for me. But there is a GUI bug, it doesn’t update to paused/resume in response to this. Reloading the GUI works.

If that is not the case for you, add some -v to curl to see if you can get more info.

Thanks for the quick answer!

I guess there must be something wrong with my installation then - Reloading (or even using another browser) does not show a paused syncthing.

Using the -v option didn’t give me any obvious error message:

curl -v -k --insecure -X POST -H X-API-Key:REPLACEAPIKEY ‘https://127.0.0.1:8384/rest/system/pause

  • Trying 127.0.0.1…
  • TCP_NODELAY set
  • Connected to 127.0.0.1 (127.0.0.1) port 8384 (#0)
  • ALPN, offering http/1.1
  • Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
  • successfully set certificate verify locations:
  • CAfile: /etc/ssl/certs/ca-certificates.crt CApath: /etc/ssl/certs
  • TLSv1.2 (OUT), TLS header, Certificate Status (22):
  • TLSv1.2 (OUT), TLS handshake, Client hello (1):
  • TLSv1.2 (IN), TLS handshake, Server hello (2):
  • TLSv1.2 (IN), TLS handshake, Certificate (11):
  • TLSv1.2 (IN), TLS handshake, Server key exchange (12):
  • TLSv1.2 (IN), TLS handshake, Server finished (14):
  • TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
  • TLSv1.2 (OUT), TLS change cipher, Client hello (1):
  • TLSv1.2 (OUT), TLS handshake, Finished (20):
  • TLSv1.2 (IN), TLS change cipher, Client hello (1):
  • TLSv1.2 (IN), TLS handshake, Finished (20):
  • SSL connection using TLSv1.2 / ECDHE-RSA-AES256-SHA
  • ALPN, server did not agree to a protocol
  • Server certificate:
  • subject: CN=dionysus
  • start date: Apr 9 11:42:17 2017 GMT
  • expire date: Dec 31 23:59:59 2049 GMT
  • issuer: CN=dionysus
  • SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.

POST /rest/system/pause HTTP/1.1 Host: 127.0.0.1:8384 User-Agent: curl/7.52.1 Accept: / X-API-Key:HEREITWRITESTHEAPIKEY

< HTTP/1.1 200 OK < Access-Control-Allow-Origin: * < Cache-Control: max-age=0, no-cache, no-store < Expires: Sun, 21 May 2017 20:26:13 GMT < Pragma: no-cache < X-Syncthing-Id: HEREITWRITESTHEYSYNCTHNGID < X-Syncthing-Version: v0.14.26 < Date: Sun, 21 May 2017 20:26:13 GMT < Content-Length: 0 < Content-Type: text/plain; charset=utf-8 <

  • Curl_http_done: called premature == 0
  • Connection #0 to host 127.0.0.1 left intact

I only just noticed that there is already a version 0.14.28… will upgrade as soon as possible and see if it possibly solves this.

Me again,…

Working! Problem solved!

I actually had looked at the status of the folder, which remains untouched. But it actually disconnects the other peers. Now it seems to do what i need it to do!

Thanks a lot!!

GitHub ticket: https://github.com/syncthing/syncthing/issues/4172