OK. Slightly complex set of circumstances here. I have a syncthing
config.xml, and I’d like to know whether there is a syncthing instance running which is using this
config.xml as its config.
There are many different
config.xmls, and many different syncthing instances running on this machine, so “is syncthing running at all” is not enough. Also, the port is specified as
0, not as a specific port (because there are many syncthings, so they need to not collide on port numbers), so I can’t read
config.xml for its
listenAddress and then try connecting to it with the appropriate auth. Syncthing does not, as far as I can tell, write a pidfile or something like it. However, if I try to start syncthing with that config file again and it is already running, I get a database collide, so something knows it’s already running. I can, of course, just use that as my method: to find out whether there’s a syncthing running for this config, try starting a new one and see if it errors. But that’s a bit inelegant Is there a better way?