I2P

Invisible Internet Project


root/installer/resources/install_i2p_service_winnt.bat @ 93a57a1543713d65f142e9570751bda1129f3d51

Revision 93a57a1543713d65f142e9570751bda1129f3d51, 1.0 KB (checked in by kytv@…, 2 years ago)

Attempt to remove the service before trying to install it.

My rationale for this:
1) in case someone is installing I2P on top of an already existing installation

this will cause I2P to be shutdown

2) no hangs during the installation if i2p is already installed as a service
3) in case the NT service settings are changed in wrapper.config by us, this

will force the service settings to be updated.

4) versions of I2P < 0.8.7 did not remove the service when uninstalling. If someone

removed I2P in the past and reinstalls I2P--opting to run as a service--the
installation process will hang.

Line 
1@echo off
2setlocal
3
4rem
5rem Java Service Wrapper general NT service install script
6rem
7
8if "%OS%"=="Windows_NT" goto nt
9echo This script only works with NT-based versions of Windows.
10goto :eof
11
12:nt
13rem
14rem Find the application home.
15rem
16rem %~dp0 is location of current script under NT
17set _REALPATH=%~dp0
18set _WRAPPER_EXE=%_REALPATH%I2Psvc.exe
19
20rem
21rem Find the wrapper.conf
22rem
23:conf
24set _WRAPPER_CONF="%~f1"
25if not %_WRAPPER_CONF%=="" goto startup
26set _WRAPPER_CONF="%_REALPATH%wrapper.config"
27
28rem
29rem Install the Wrapper as an NT service.
30rem
31:startup
32:: We remove the existing service to
33:: 1) force the service to stop
34:: 2) update service configuration in case wrapper.config was edited
35:: 3) prevent hanging the installer if 'install as service' is selected
36::    and it's already enabled as a service.
37"%_WRAPPER_EXE%" -r %_WRAPPER_CONF%
38"%_WRAPPER_EXE%" -i %_WRAPPER_CONF%
39if not errorlevel 1 goto :eof
40if %2=="--nopause" goto :eof
41pause
42
43:eof
Note: See TracBrowser for help on using the browser.