mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

jvergara
05.11.2007 e6eab56a4ebd79049b1e64b70ec7363a2929d1d2
Fix for issue 2187 (start-ds dos not return proper error code).

Use the --checkstartability option to know if the server is running or not and return the proper error code accordingly.
2 files modified
37 ■■■■■ changed files
opendj-sdk/opends/resource/bin/start-ds 16 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/resource/bin/start-ds.bat 21 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/resource/bin/start-ds
@@ -158,6 +158,22 @@
    "${JAVA_BIN}" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete \
         --targetFile "${STARTING_FILE}"
  fi
  EC=${?}
  if test ${EC} -eq 0
  then
    # An exit code of 98 means that the server is already running.
    ${JAVA_BIN} ${SCRIPT_NAME_ARG} org.opends.server.core.DirectoryServer \
            --configClass org.opends.server.extensions.ConfigFileHandler \
            --configFile "${CONFIG_FILE}" --checkStartability
    EC=${?}
    if test ${EC} -eq 98
    then
        exit 0
    else
      # Could not start the server
      exit 1
    fi
  fi
  exit ${?}
else
  if test ${EC} -eq 100
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%