[Now Implemented!] Btsync As A Windows Service


upcboy

Recommended Posts

In response to love2scoot, I can confirm that if you wrap 1.4.103 in "nssm" and run it as a service using the "/webui" command line switch you can then access the user web GUI at the loopback address.

I'm doing this on a WHS 2011 (Server 2008 based) and the GUI comes up in the default browser as set for your logon. Being anal about these things, I've created a Firefox persona for sync so that I can run it in minimalist window rather than the full tabbed browser, from a desktop shortcut.

What would be nice now is to able to log in remotely, at the moment the web GUI seems to be hard coded to the loopback address and as a consequence can only be accessed from the local machine.

Big step forward anyway, at least you can manage it without stopping the service and running a local instance.

SNG

Link to comment
Share on other sites

What would be nice now is to able to log in remotely, at the moment the web GUI seems to be hard coded to the loopback address and as a consequence can only be accessed from the local machine.

Just run sync with the /CONFIG switch, specify a config file containing a different listen address (or 0.0.0.0 to listen on all addresses), and you'll be able to access Sync from other devices accordingly

Link to comment
Share on other sites

(Thanks to user SNG for doing some of the leg work here)
 
I think we finally have a working solution for running Bittorrent Sync as a service.
 
One of the features added in 1.4.103 is the ability to run a command line argument "/webui" which sets the default interface to a web page.  This feature finally gets us over the finish line and allows for true run as a service under Windows.
 
Prerequisites:
  • Install / Update Bittorrent Sync to at least version 1.4.103 and run the application.
  • Download the latest NSSM (Non-Sucking Service Manager) from http://nssm.cc/ and extract the contents. (I used v2.24)
  • Create a text file in the Bittorent Sync Program Files folder called "btsync.conf" and populate this file with the following lines:
{  "device_name": "HOSTNAME",  "webui" :  {    "listen" : "0.0.0.0:8888",    "login" : "USERNAME",    "password" : "PASSWORD"  }}
  •  Replace HOSTNAME with the name that you wish to use to identify the Bittorrent Sync instance.
  •  Replace USERNAME with the username you wish to use for the WebUI credentials.
  •  Replace PASSWORD with the username you wish to use for the WebUI credentials.
  •  The "listen" line is important because the WebUI only responds to local loopback by default while 0.0.0.0 allows for response to any host.  You may optionally specify an IP to limit responses to that specific host.

Installation as a Service:

  • Open a command prompt (with Admin privileges for Windows OSs newer than XP/2003) and change directories into the extracted NSSM folder from step 2.
  • Type "nssm install btsync", and the GUI interface for NSSM will appear.
    • In the "Application" tab, click the ellipse button, browse to the Bittorrent Sync Program Files folder, and select "BTsync.exe"
    • It will populate the "Startup Directory" field, leave this at default
    • Under the "Arguments" field, enter "/webui /config btsync.conf"
    • (optional) Under the "Details" tab, enter "Bittorrent Sync Service Wrapper" in the "Display Name" field.
    • Make sure that "Startup type" is set to "Automatic"
    • Leave all other fields at default and click the "Install Service" button.
  • Make sure to close the instance of Bittorrent Sync if it is currently running in your user session.
  • Open the Services.msc snap-in, select "Bittorrent Sync Service Wrapper", and click start.
  • Open a browser on the same local network, and enter http://HOSTNAME:8888 (where HOSTNAME is the name of the computer).  You should be prompted to enter credentials.
 
You're done!  You should now be able to manage Bittorrent Sync on the computer without an active user session.
 
I have completed the above procedure on two separate servers (2003R2) and was able to successfully sync data between them, after setting up the folders using Chrome from a third computer.
Link to comment
Share on other sites

Another small problem (with solution), the service is spawning an instance of the default browser in the background. No console associated with it so you can't see it. This doesn't upset IE but Firefox doesn't like it throwing up an error if you try to call it up again, as it tries to add a tab to the “hidden” process.

A trawl through the registry on my desktop machine to see how autostart is handled threw up the somewhat obvious “/minimized” switch. So we just need to add this to the arguments we are passing through nssm, making that line:

Under the "Arguments" field, enter "/webui /config btsync.conf /minimized"

and now sync starts silently in the nonexistent task tray.

SNG

Link to comment
Share on other sites

We got report from user, that he was able to start Sync as service on Windows Server 2008 R2 using following instructions.

http://support.microsoft.com/kb/137890

This is not generic case, but might help you.

Instructions:

1. Copy instsrv.exe & srvany.exe to C:\Program Files (x86)\BitTorrent Sync, you should get these files from Windows NT Resource Kit

2. In Command Line from Administrator execute following:

cd C:\Program Files (x86)\BitTorrent Sync

instsrv BTSync “C:\Program Files (x86)\BitTorrent Sync\srvany.exe”

regedit

 

Hi,

Thanks for this thread. When following the process above on Windows 2008 R2 Server 64 Bits. I get the following error in Command while doing STEP 2 above.

" - The fully qualified path to the .EXE must be given"

I have checked manually and the path is fine..

Matthieu

Edited by matbkk
Link to comment
Share on other sites

  • 3 weeks later...

Since there is no server edition of the software, I am running BitTorrent Sync via NSSM-Tool as Windows Service. However, it would make sense to provide a Server edition, which installs as a Windows Service and is configurable via UI.

 

In fact I would suggest going even a step further and doing the synchronization even on desktop installations only through Windows Services and the UI is just configuring, as this would also offload processing from the application to the service.

 

Thx

Link to comment
Share on other sites

I just found this wonderful piece of software, got excited, and… what are you guys thinking, the thought here is upside down. As a few others written here as well.. put the working in a process, and separate the settings. The settings can be a webpage or an app. 

 

However, there will always be people wanting to use tho differently. Some wants to run it as a server - it shouldn't matter who is /isn't logged in to the computer, and some wants it to be completely the opposite. This needs to be a setting. You might want to have this setting at install, or as a separate product to be able to make some money from this.

 

As for my self, I can't use this piece of software for my private needs until this feature is here - my server is logged in as a user who can't access my files. In the professional needs, it could be a new dedicated virtual machine with auto login and syncing a network folder, but its not a pretty solution.

Link to comment
Share on other sites

  • 4 weeks later...

I really was hoping that one of 2.0 main features would be to use it as a Service under Microsoft Windows.

I know the work arounds that exist for Sync 1.x will (should) also work for 2.0, but I was hoping for this ability to be baked into the 2.0 software.

Is this in the works? Or do I need to get a SAN to have access to a similar always on feature?

Link to comment
Share on other sites

  • 2 weeks later...

I would like the option to have Bittorrent Sync automatically start as a service in Windows so that it can start BEFORE any user logs onto the computer. I can configure my desktop PCs to automatically reboot after a power loss. In such an event, I would like Bittorrent sync to also automatically restart itself without the need for a user to log on to the computer. The exact functionality that I want has been shown before with this method for starting Plex Media Server as a service:
 

https://forums.plex.tv/index.php/topic/93994-pms-as-a-service/

 

Thanks!

Link to comment
Share on other sites

  • 2 weeks later...

+1

I came here after receiving an e-mail telling me that Pro is available; I assumed that something targeted at business users would be able to be installed on a Windows Server as a service. When you offer that, I'll buy it, but until then you really shouldn't be claiming to be suitable for business use.

Link to comment
Share on other sites

+1

I came here after receiving an e-mail telling me that Pro is available; I assumed that something targeted at business users would be able to be installed on a Windows Server as a service. When you offer that, I'll buy it, but until then you really shouldn't be claiming to be suitable for business use.

 

+1

 

Add this option and I can use BT Sync in a business environment. Buying multiple Pro licenses is then a deal!

Link to comment
Share on other sites

  • 2 weeks later...

Update: On Vista I'm running sync 2.0 as a background task at startup on a admin user. I can't view the interface, but it syncs the previously set up shared folders in the background. Running one copy of sync per box. I hear you can view the gui through a browser on the LAN. I haven't been able to enable that in the configuration file.

Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.