Apr 092015
 

Yesterday I blogged about SyncThing as an alternative to BitTorrentSync. Today a business partner asked me whether it is possible to run SyncThing as a service. The answer is definitely yes, but it requires an additional tool.

As per this StackOverflow answer you can use NSSM – the Non-Sucking Service Manager to create a service that works fine.

I had to add the following command line arguments to the call:

  • -no-console
  • -no-browser
  • -home=”c:\users\<myaccount>\AppData\Local\Syncthing”

(Mind the extra dash after the “no”!)
The latter was because I wanted to keep using the configuration which was generated by just starting the SyncThing console application. It’s perfectly possible to move this folder somewhere else.

Also, on the I/O tab, I added log files for stdout and stderr, so I am able to see any error messages it might write. I didn’t specify any file rotation yet, but that’s probably something you want to do.

After creating the service using NSSM, I could simply start the SyncThing service and connect to it with the browser.

Due to a restriction of our router (no UPnP), I also had to configure port forwarding for port 22000 as described here for it to be able to connect to other servers over the internet.