Skip to content

Commit 6da67b5

Browse files
authoredAug 24, 2022
[BUG] Running "opensearch-service.bat start" and "opensearch-service.bat manager" (#4289) (#4292)
* [BUG] Update opensearch-service-x64.exe parameters to //ES for Execute Service. Update opensearch-service-mgr.exe parameters to //ES for Edit Service. Add code comments for the Apache Commons Daemon. Signed-off-by: Alex Burck <me@alexburck.com> * update changelog with pull request link Signed-off-by: Alex Burck <me@alexburck.com> (cherry picked from commit a3fb105) Signed-off-by: Alex Burck <me@alexburck.com> Signed-off-by: Alex Burck <me@alexburck.com>

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed
 

‎distribution/src/bin/opensearch-service.bat

+13-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ if /i "%1" == "install" set NOJAVA=
88

99
call "%~dp0opensearch-env.bat" %NOJAVA% || exit /b 1
1010

11+
rem opensearch-service-x64.exe is based off of the Apache Commons Daemon procrun service application.
12+
rem Run "opensearch-service-x64.exe version" for version information.
13+
rem Run "opensearch-service-x64.exe help" for command options.
14+
rem See https://commons.apache.org/proper/commons-daemon/procrun.html for more information.
1115
set EXECUTABLE=%OPENSEARCH_HOME%\bin\opensearch-service-x64.exe
1216
if "%SERVICE_ID%" == "" set SERVICE_ID=opensearch-service-x64
1317
set ARCH=64-bit
@@ -45,7 +49,8 @@ echo Usage: opensearch-service.bat install^|remove^|start^|stop^|manager [SERVIC
4549
goto:eof
4650

4751
:doStart
48-
"%EXECUTABLE%" //OPENSEARCH//%SERVICE_ID% %LOG_OPTS%
52+
rem //ES == Execute Service
53+
"%EXECUTABLE%" //ES//%SERVICE_ID% %LOG_OPTS%
4954
if not errorlevel 1 goto started
5055
echo Failed starting '%SERVICE_ID%' service
5156
exit /B 1
@@ -55,6 +60,7 @@ echo The service '%SERVICE_ID%' has been started
5560
goto:eof
5661

5762
:doStop
63+
rem //SS == Stop Service
5864
"%EXECUTABLE%" //SS//%SERVICE_ID% %LOG_OPTS%
5965
if not errorlevel 1 goto stopped
6066
echo Failed stopping '%SERVICE_ID%' service
@@ -65,8 +71,11 @@ echo The service '%SERVICE_ID%' has been stopped
6571
goto:eof
6672

6773
:doManagment
74+
rem opensearch-service-mgr.exe is based off of the Apache Commons Daemon procrun monitor application.
75+
rem See https://commons.apache.org/proper/commons-daemon/procrun.html for more information.
6876
set EXECUTABLE_MGR=%OPENSEARCH_HOME%\bin\opensearch-service-mgr
69-
"%EXECUTABLE_MGR%" //OPENSEARCH//%SERVICE_ID%
77+
rem //ES == Edit Service
78+
"%EXECUTABLE_MGR%" //ES//%SERVICE_ID%
7079
if not errorlevel 1 goto managed
7180
echo Failed starting service manager for '%SERVICE_ID%'
7281
exit /B 1
@@ -77,6 +86,7 @@ goto:eof
7786

7887
:doRemove
7988
rem Remove the service
89+
rem //DS == Delete Service
8090
"%EXECUTABLE%" //DS//%SERVICE_ID% %LOG_OPTS%
8191
if not errorlevel 1 goto removed
8292
echo Failed removing '%SERVICE_ID%' service
@@ -207,6 +217,7 @@ if not "%SERVICE_USERNAME%" == "" (
207217
set SERVICE_PARAMS=%SERVICE_PARAMS% --ServiceUser "%SERVICE_USERNAME%" --ServicePassword "%SERVICE_PASSWORD%"
208218
)
209219
)
220+
rem //IS == Install Service
210221
"%EXECUTABLE%" //IS//%SERVICE_ID% --Startup %OPENSEARCH_START_TYPE% --StopTimeout %OPENSEARCH_STOP_TIMEOUT% --StartClass org.opensearch.bootstrap.OpenSearch --StartMethod main ++StartParams --quiet --StopClass org.opensearch.bootstrap.OpenSearch --StopMethod close --Classpath "%OPENSEARCH_CLASSPATH%" --JvmMs %JVM_MS% --JvmMx %JVM_MX% --JvmSs %JVM_SS% --JvmOptions %OTHER_JAVA_OPTS% ++JvmOptions %OPENSEARCH_PARAMS% %LOG_OPTS% --PidFile "%SERVICE_ID%.pid" --DisplayName "%SERVICE_DISPLAY_NAME%" --Description "%SERVICE_DESCRIPTION%" --Jvm "%JAVA_HOME%%JVM_DLL%" --StartMode jvm --StopMode jvm --StartPath "%OPENSEARCH_HOME%" %SERVICE_PARAMS% ++Environment HOSTNAME="%%COMPUTERNAME%%"
211222

212223
if not errorlevel 1 goto installed

0 commit comments

Comments
 (0)
Please sign in to comment.