stoping syncthing on the cli

Hi,

Is there a way to stop syncthing via the command line ?

kind of the same as Pause a folder to stop syncthing scanning/updating it but with the CLI, not the web interface

details :

I sync 2 slaves from one master, but now I need to push modifs on the 3 boxes simultaneously becos they are production front ends so I am planning to first put the data on the slaves(in a temp folder), then at the last moment put these data on the master too (in a temp folder)

once all done, I delete the old production folder on the 3 boxes and rename the temp folder, so the ACC->PROD goes super fast

technicaly, doing it that way, the sync will then synchronize files that are the same on the three boxes, so no big deal, …

but I was wondering if there was a way to stop the sync before doing all that , and then telling syncthing not to update the last changes since it would take resources for nothing

thanks

CLI depends a bit on your operating system. Locally, on something lunixy, pkill syncthing works fine. Otherwise, using the API,

curl -X POST -H X-API-Key:abc123 http://localhost:8384/rest/system/shutdown.

nice

but as the other thread discussion, as soon as I do a start (how?)

syncthing will synchronize these folders right ?

I’m not sure what you mean, sorry.

  • how do I restart it with CURL
  • when syncthing restart, will it synchronize the folder that has just been modified on the master ? as they are now identical with the slaves, this should be avoided
  • where can I find the API key ?

Why do you need to restart it? But, to restart it you can use the restart method instead of shutdown. Documentation: https://docs.syncthing.net/dev/rest.html

The API key is in the settings dialog in the GUI and the config file.

Syncthing will indeed synchronize all folders on startup. If there are no changes to synchronize, it will do nothing.

ok … well I need to restart it becos sync has to be the default behaviour of my architecture

by the way, I monitor my boxes with zabbix, so I was wondering, does port 8384 stops listenning when a shutdown occurs ? so I can monitor that port to send alerts when the sync is not running

Sort of… Syncthing will scan the folder and look for changes from what it last saw. The different files will be found and rehashed then each instance will announce it’s newly discovered changes to the other nodes. Each node then requests any blocks it is missing but since they will not start doing this until they have finished checking the local changes none of them should have any blocks to pull. They will synchronise the permission and mod times though.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.