Command to check the status of syncthing

Hi there, I am using Syncthing in my project as the file synchronization tool. During the running of my software, I would like to check the status of Syncthing periodically, i.e. whether it is running or not. Is there such a command in Syncthing to do this? To be more specific, does there exist any command in the following form

syncthing.exe -some_argument

which will tell me the status.

I am aware that there a command line tool, syncthing-cli, does this. I can simply call

syncthing-cli -status

and then it will tell me if config is in sync or connection rejected, from which I can tell if syncthing is running. However, I do not want to include syncthing-cli in my software… :sweat:

you can use something like this:

if !(curl -s | grep '{"ping":"pong"}' > /dev/null 2>&1); then
    echo "syncthing not running"
    echo "syncthing running"

Thanks for your reply. Hmmm… I am working on windows. I don’t want unix command… I know I can use the REST interface to query and manage Syncthing’s status. I am wondering whether there exists an internal command in Syncthing executable, which I can use to determine its status.

Basicly, I cannot use the REST interface as it is not support in the software I am working on and I prefer not to include any third party software apart from Syncthing itself…

I found a dirty way to do this… I can run one instance using a specified configuration folder (config.xml, key.pem, cert.pem), then try to run Syncthing from the same configuration folder again. Then Syncthing will complain that it cannot load the database because some other instance is using it… If it complains, I know it’s already running… Not very elegant… I know…

You can use syncthing-cli, or check for running processes. There is no command in syncthing.

Thanks. Yep, I decided to check the running processes. :smile: