Windows Command Line Graceful Startup and Shutdown possible?


#1

Hey All,

I’ve search the command line help (https://docs.syncthing.net/users/syncthing.html) and google isn’t my friend on this one, I’m looking to make sure that Syncthing can be started up and closed down from the task scheduler on windows, while I know I can taskkill /f /im, etc, I would like to make sure it’s closed down gracefully, so any files being written or read, etc, are not corrupted. (I know start up is possible, but I’m worried a startup fail will happen if the shutdown wasn’t proper)

Is is possible from command-line, i.e. syncthing.exe -shutdown and then it will wait until an operation is complete and the close itself?

Thanks for your time in this.


(Jakob Borg) #2

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

(Or the powershell equivalent; I know powershell has “curl” but not sure if the options match up.)


#3

I’m not confident with powershell to know if I would be doing it correct of not.

was hoping for a windows command line switch to be the solution.


(Antony Male) #4

If you’re using SyncTrayzor there are command line flags to can pass to it to start and stop syncthing gracefully. That might not fit your use case though.


(Bt90) #5

taskill (without the /f option) sends a termination signal to the syncthing process which in turn should handle the signal and shut down properly.

taskill /f on the other hand will basically murder the process.


(system) #6

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