Wednesday, June 1, 2016

Run Seafile Windows client as a background service

We will need:

Step by step guide:
  1. Install and configure the Seafile client as usual, turn on synchronization for desired libraries.
  2. Quit the Seafile client (right click on tray icon and choose Quit)
  3. Download and extract NSSM
  4. Start the command prompt (Win+S -> cmd) and navigate to nssm.exe file, for example if you extracted it on Your desktop, type in the command prompt CD C:\Users\Your_user_name\Desktop\NSSM_folder_name\win64
  5. Type in the command prompt nssm install ccnet (this service will manage the network)
  6. NSSM service installer window will open, click the "..." button and navigate to C:\Program Files (x86)\Seafile\bin\ccnet.exe
  7. Fill arguments as described in documentation, change Administrator to Your user name
  8. Click the tab Log on, choose "This account" and enter Your credentials
  9. Click Install service - one done, one to go
  10. Type in the command prompt nssm install seaf-daemon (this service will manage the files)
  11. NSSM service installer window will open, click the "..." button and navigate to C:\Program Files (x86)\Seafile\bin\seaf-daemon.exe
  12. As for arguments this one is a bit trickier, -c argument is same as in step 5, -d argument value can be found in C:\Users\Your_user_name\ccnet\seafile.ini file and -w value is path to Your Seafile data folder, for example: -c C:\Users\Admin\ccnet -d C:\Users\Admin\Documents\Seafile\seafile-data -w C:\Users\Admin\Documents\Seafile
  13. Same as earlier click the Log on tab, choose This account and enter Your credentials
  14. Click Install service, and it's done
  15. Now restart the PC or start the services manually (Win+S -> Services -> look for ones named ccnet and seaf-daemon)

Read the NSSM Usage guide for more information.

Update: documentation linked in step 7 is no longer available, but You can check required parameters by executing commands ccnet -h and seaf-daemon -h in folder C:\Program Files (x86)\Seafile\bin\.

4 comments:

  1. Hi, I followed your tutorial but I'm unable to get seafile to sync files with this. I have the services setup and they are running, I don't see any obvious errors in the logs. Has something changed? Do you know if this still works with current versions of seafile?

    ReplyDelete
    Replies
    1. Just in case anyone else runs across this. I figured out what was happening. By default seafile client makes a folder called my lib, I should have noticed sooner but that needs "" around the location if there's a space.

      Delete
  2. Hello. I can't find a ccnet.exe file in Seafile folder. I'm running seafile client 6.2.4. Probably something had changed in recent seafile client version? But official FAQ you mention in the article also says ccnet.exe should exist. I've reinstalled Seafile 6.2.4, but no ccnet.exe again. :(

    ReplyDelete
  3. Seafile 6.1.8 has ccnet.exe in its folder. Probably I can just skip steps 6-9.

    ReplyDelete