From e6eab56a4ebd79049b1e64b70ec7363a2929d1d2 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 05 Sep 2007 16:11:25 +0000
Subject: [PATCH] Fix for issue 2187 (start-ds dos not return proper error code).

---
 opendj-sdk/opends/resource/bin/start-ds.bat |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/opendj-sdk/opends/resource/bin/start-ds.bat b/opendj-sdk/opends/resource/bin/start-ds.bat
index 2a8e243..4eceb4c 100644
--- a/opendj-sdk/opends/resource/bin/start-ds.bat
+++ b/opendj-sdk/opends/resource/bin/start-ds.bat
@@ -109,7 +109,7 @@
 "%DIR_HOME%\lib\winlauncher.exe" start "%DIR_HOME%" "%JAVA_BIN%" %JAVA_ARGS%  org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" %*
 echo %SCRIPT%: Waiting for "%DIR_HOME%\logs\server.out" to be deleted >> %LOG%
 "%JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%DIR_HOME%\logs\server.starting" --logFile "%DIR_HOME%\logs\server.out"
-goto end
+goto checkStarted
 
 :runDetachCalledByWinService
 rem We write the output of the start command to the winservice.out file.
@@ -122,7 +122,7 @@
 echo %SCRIPT%: Waiting for "%DIR_HOME%\logs\server.out" to be deleted >> %LOG%
 "%JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%DIR_HOME%\logs\server.starting" --logFile "%DIR_HOME%\logs\server.out" --outputFile "%DIR_HOME%\logs\winservice.out"
 erase "%DIR_HOME%\logs\server.startingservice"
-goto end
+goto checkStarted
 
 :runAsService
 echo %SCRIPT%: Run as service >> %LOG%
@@ -132,6 +132,21 @@
 rem Type the contents the winwervice.out file and delete it.
 if exist "%DIR_HOME%\logs\winservice.out" type "%DIR_HOME%\logs\winservice.out"
 if exist "%DIR_HOME%\logs\winservice.out" erase "%DIR_HOME%\logs\winservice.out"
-:end
+goto end
 
+:checkStarted
+"%JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.core.DirectoryServer --configClass org.opends.server.extensions.ConfigFileHandler --configFile "%DIR_HOME%\config\config.ldif" --checkStartability
+if %errorlevel% == 98 goto serverStarted
+goto serverNotStarted
+
+:serverStarted
+echo %SCRIPT%: finished >> %LOG%
+exit /B 0
+
+:serverNotStarted
+echo %SCRIPT%: finished >> %LOG%
+exit /B 1
+
+
+:end
 echo %SCRIPT%: finished >> %LOG%

--
Gitblit v1.10.0