+ Reply to Thread
Results 1 to 9 of 9

Thread: [Tutorial] Run your client as a service

  1. #1

    [Tutorial] Run your client as a service

    Having recently set up a dedicated file server at home, I decided to move my torrent client to this machine instead. The machine's currently also set up as a media center running on top of Windows 8.1 and is hooked up to my tv set.

    The annoying thing with this setup, however, is that you have to log in and start the torrent client before it will actually download anything. Since I often turn on the machine with a Wake On Lan packet I send out with my phone, it's a hassle having to manually log in.

    To fix this, there are two options. Didn't find any thread related to this on sb-i, so I thought I'd share~

    First option is to let windows automatically log in. I don't prefer this, but I thought i'd put it down here anyway. You can achieve this by pressing Win+R. The "run" prompt now appears. In the box, type in netplwiz. Uncheck the option "Users must enter a user name and password to use this computer.". Press apply and supply the account and password that will be used to log in. If you configure your client to auto start up, you will be home free. Since I personally don't like this way of working (as you have to circumvent the password security), I looked up another option.




    Second way to achieve it, is running your client as a service. On newer windows you can easily create a service using powershell. (If at any point one of the commands isn't working, try looking up how to use SRVANY.exe.)


    First you need to configure your client, preferably with a dedicated windows account that you will be using to run the torrent client on. Set up a web remote to access the client with remotely (e.g. Vuze remote for vuze, WebUI for uTorrent, ...)


    Then you need to create the windows service. This will be done with the "New-Service" commandlet. Open a powershell console as administrator and type:

    new-service TorrentService "C:\Program Files\PathTo\YourClient.exe"

    After creating the service, you can find it again in a GUI by pressing Win+R again and this time running "services.msc". Right click and select properties to configure the service visually.
    • Startup type: Automatic
    • Log On: Select "This Account"
      • Select browse and select the account you used to configure the client.
      • This is important because settings are mostly stored in the AppData folder for that account (so they are account based!)
    • Type in the accounts password.
    • Click apply -> ok


    It's generally wise to restrict that account so it only has rights to the download folder and doesn't have any remote desktop rights (nor admin rights!)



    Note: if you want to delete the service again, run the following powershell commands:

    $serviceToRemove = Get-WmiObject -Class Win32_Service -Filter "name='TorrentService'"
    $serviceToRemove | Stop-Service
    $serviceToRemove.delete()



    Of course, this isn't limited to just your torrent client. If you want, you can create a service for other tools as well. Dropbox is another useful tool to have running as a service. (Don't forget to turn off desktop notifications before running it as a service.)



    Feel free to ask questions if you're having trouble with something. Happy to help out!
    Reply With QuoteReply With Quote
    Thanks

  2. Who Said Thanks:

    anon (19.02.14) , Lucius (18.02.14)

  3. #2
    Why running the client as a service anyway ?
    I can just make it auto start with windows.

    Thanks for the tutorial, that's my first time reading such information.
    Reply With QuoteReply With Quote
    Thanks

  4. #3
    You have to log in to make it auto start with windows, which requires manual intervention or not setting up a password on your pc.
    As soon as you log out, the client will stop running as well.

    Running it as a service circumvents that.

    Note that this is meant for a headless pc, not for your desktop.
    Reply With QuoteReply With Quote
    Thanks

  5. Who Said Thanks:

    Lucius (19.02.14)

  6. #4
    Moderator anon's Avatar
    Join Date
    01.02.08
    Posts
    39,451
    Activity Longevity
    8/20 19/20
    Today Posts
    1/5 ssss39451
    Log On: Select "This Account"
    Select browse and select the account you used to configure the client.
    This is important because settings are mostly stored in the AppData folder for that account (so they are account based!)
    As an additional tidbit, I wanted to point out that if you didn't do this, the client would run under the NT AUTHORITY\SYSTEM account, which due to how Windows lays out NTFS and registry permissions, is the de facto absolute power under NT; even higher than an administrator account. And with the right programs you can easily make it run anything else you want on demand, very useful for deleting clingy directories and registry keys.

    RunasSystem and RunFromToken - reboot.pro
    RunAtWinlogon - reboot.pro
    "I just remembered something that happened a long time ago."
    Reply With QuoteReply With Quote
    Thanks

  7. Who Said Thanks:

    Lucius (19.02.14)

  8. #5

    Join Date
    14.06.09
    Location
    Arkadia
    P2P Client
    rTorrent
    Posts
    445
    Activity Longevity
    0/20 18/20
    Today Posts
    0/5 ssssss445
    Quote Originally Posted by Tattah View Post
    Why running the client as a service anyway ?
    To hide in on some PC with fat pipe and use it as your secret seedbox.
    Reply With QuoteReply With Quote
    Thanks

  9. Who Said Thanks:

    Lucius (21.02.14)

  10. #6
    Quote Originally Posted by shadowww View Post
    To hide in on some PC with fat pipe and use it as your secret seedbox.
    Good point

    Nah, it's just so much easier this way when building your own NAS from scratch or running a WHS box and for some reason decide you feel better with having windows on there instead of linux. (which is the case for me)
    The box' ram stays clear from having a full profile loaded up with explorer.exe and all the other extra's, since you don't have to log into the machine to start the service.
    Reply With QuoteReply With Quote
    Thanks

  11. Who Said Thanks:

    Lucius (21.02.14)

  12. #7
    Quote Originally Posted by Sazzy View Post
    Good point

    Nah, it's just so much easier this way when building your own NAS from scratch or running a WHS box and for some reason decide you feel better with having windows on there instead of linux. (which is the case for me)
    The box' ram stays clear from having a full profile loaded up with explorer.exe and all the other extra's, since you don't have to log into the machine to start the service.
    wow, so we can make a semi-non-GUI windows computer. But is there a side effects of using this approach ?
    you gave a note of disabling the desktop notification of some app.
    I hope we can make mR running as a service, maybe a web UI for mR will be a great feature request
    Last edited by Lucius; 21.02.14 at 09:42. Reason: correcting word
    Reply With QuoteReply With Quote
    Thanks

  13. #8
    Moderator anon's Avatar
    Join Date
    01.02.08
    Posts
    39,451
    Activity Longevity
    8/20 19/20
    Today Posts
    1/5 ssss39451
    Quote Originally Posted by Tattah View Post
    wow, so we can make a semi-non-GUI windows computer.
    Someone made a custom XP that includes only the Command Prompt interface and needs 10 MB of disk space. Not everything works on it, but if the programs you want do, it's perfect to repurpose an old computer as a NAS. Think it was called "XPCLI" or something like that.
    "I just remembered something that happened a long time ago."
    Reply With QuoteReply With Quote
    Thanks

  14. Who Said Thanks:

    Lucius (21.02.14)

  15. #9
    Quote Originally Posted by Tattah View Post
    wow, so we can make a semi-non-GUI windows computer. But is there a side effects of using this approach ?
    you gave a note of disabling the desktop notification of some app.
    I hope we can make mR running as a service, maybe a web UI for mR will be a great feature request
    No side affects that I know of, anyway.
    Services don't have access to the desktop, thus for dropbox you have to disable that feature to keep it happy.

    Quote Originally Posted by anon View Post
    Someone made a custom XP that includes only the Command Prompt interface and needs 10 MB of disk space. Not everything works on it, but if the programs you want do, it's perfect to repurpose an old computer as a NAS. Think it was called "XPCLI" or something like that.
    Could just run freedos in that case! :)
    Reply With QuoteReply With Quote
    Thanks

  16. Who Said Thanks:

    Lucius (21.02.14)

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •