Windows service configuration

Mikhail Titov
2016-03-10 23:32:22 -06:00
parent 985ce3a005
commit 22d6fd4744
2 changed files with 66 additions and 0 deletions

@@ -0,0 +1,66 @@
### Introduction
One can set up i2pd as a Windows Service. This way it will run in the
background without any annoying windows or tray icons. It can be
controlled with a standard
[*Services*](https://technet.microsoft.com/en-us/library/cc772408.aspx)
snap-in of *Microsoft Management Console (MMC)*.
While it is possible to install service using corresponding
[command line option](https://github.com/PurpleI2P/i2pd/blob/openssl/docs/configuration.md),
standard tools like
[sc](https://technet.microsoft.com/en-us/library/cc990289.aspx) can be
used as well. Currently, this gives some flexibility as there in no
need to add `daemon = yes` in config, but `--daemon` can be supplied
as an argument.
### Service installation
Fire up elevated Command Prompt (<kbd>Win+X</kbd>, <kbd>A</kbd> in
Windows 8) and type in the following making sure you use the correct
path where you have `i2pd.exe`. Mind spaces after `=`.
```
sc create i2pService binPath= "C:\dev\i2p\appveyor\i2pd.exe --daemon" DisplayName= "i2p router service" obj= "NT AUTHORITY\LocalService"
```
This way, the service will run under special *LocalService* user
account. Its configuration folder is likely
`C:\Windows\ServiceProfiles\LocalService\AppData\Roaming\i2pd`. You
will need elevated privileges to access this location. You may find it
handy to use [Far File Manager](http://www.farmanager.com) or alike
for such manipulations.
![screenshot](Setting-up-i2pd-as-Windows-Service.png)
### Service removal
To uninstall this service use
```
sc delete i2pService
```
from the eleveated Command Prompt. Make sure that MMC is closed,
especially if you plan to reinstall it. Otherwise it will only be
marked for deletion thus preventing subsequent creation.
### Regular user account
You can also run i2pd service under your user account if you want to
use exactly the same configuration. Keep in mind security implications
if you chose so<sup>1</sup>.
Using *Services* snap-in of MMC, set your credentials for *i2pd router
service* in its properties on *Log On* tab. Your user account _must_
have a password that you'd have to keep updated in Services snap-in of
MMC. It is, probably, possible to disable this via policies, but you
should know what you are doing.
You can leave password field blank if you are changing account back to
`NT AUTHORITY\LocalService`.
---
<sup>1</sup>Although it is no different than running *i2pd* as a
regular desktop application.

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB