stop-ds.bat revision 857
2N/A
2N/A@echo off
2N/Arem CDDL HEADER START
2N/Arem
2N/Arem The contents of this file are subject to the terms of the
2N/Arem Common Development and Distribution License, Version 1.0 only
2N/Arem (the "License"). You may not use this file except in compliance
2N/Arem with the License.
2N/Arem
2N/Arem You can obtain a copy of the license at
2N/Arem trunk/opends/resource/legal-notices/OpenDS.LICENSE
2N/Arem or https://OpenDS.dev.java.net/OpenDS.LICENSE.
2N/Arem See the License for the specific language governing permissions
2N/Arem and limitations under the License.
2N/Arem
2N/Arem When distributing Covered Code, include this CDDL HEADER in each
2N/Arem file and include the License file at
2N/Arem trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
2N/Arem add the following below this CDDL HEADER, with the fields enclosed
2N/Arem by brackets "[]" replaced with your own identifying * information:
2N/Arem Portions Copyright [yyyy] [name of copyright owner]
2N/Arem
2N/Arem CDDL HEADER END
2N/Arem
2N/Arem
2N/Arem Portions Copyright 2006-2007 Sun Microsystems, Inc.
2N/A
2N/Asetlocal
2N/A
2N/Aset PATH=%SystemRoot%
2N/A
2N/Aset OPENDS_INVOKE_CLASS="org.opends.server.tools.StopDS"
2N/Aset SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=stop-ds"
2N/Aset DIR_HOME=%~dP0..
2N/A
2N/A:checkJavaBin
2N/Aif "%JAVA_BIN%" == "" goto noJavaBin
2N/Agoto setClassPath
2N/A
2N/A:noJavaBin
2N/Aif "%JAVA_HOME%" == "" goto noJavaHome
2N/Aif not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
2N/Aset JAVA_BIN=%JAVA_HOME%\bin\java.exe
2N/Agoto setClassPath
2N/A
2N/A:noJavaHome
2N/Aif not exist "%DIR_HOME%\bin\set-java-home.bat" goto noSetJavaHome
2N/Acall "%DIR_HOME%\bin\set-java-home.bat"
2N/Aset JAVA_BIN=%JAVA_HOME%\bin\java.exe
2N/Agoto setClassPath
2N/A
2N/A:noSetJavaHome
2N/Aecho Error: JAVA_HOME environment variable is not set.
2N/Aecho Please set it to a valid Java 5 installation.
2N/Agoto end
2N/A
2N/A:setClassPath
2N/AFOR %%x in ("%DIR_HOME%\lib\*.jar") DO call "%DIR_HOME%\bin\setcp.bat" %%x
2N/A
2N/A
2N/Aset RESTART=0
2N/Aset NO_ARG_OR_ONLY_RESTART=1
2N/A
2N/Afor %%x in (%*) DO set NO_ARG_OR_ONLY_RESTART=0
2N/Aif "%NO_ARG_OR_ONLY_RESTART%" == "1" goto execute
2N/A
2N/Afor %%x in (%*) DO if "%%x" == "-R" set RESTART=1
2N/Afor %%x in (%*) DO if "%%x" == "--restart" set RESTART=1
2N/A
2N/Agoto testParameter1
2N/A
2N/A:testParameter1
2N/Aif not "%1" == "-R" goto testParameter1b
2N/Agoto testParameter2
2N/A
2N/A:testParameter1b
2N/Aif not "%1" == "--restart" goto execute
2N/Agoto testParameter2
2N/A
2N/A:testParameter2
2N/Aif "%2" == "" set NO_ARG_OR_ONLY_RESTART=1
2N/Aif "%NO_ARG_OR_ONLY_RESTART%" == "1" goto execute
2N/Aif not "%2" == "-R" goto testParameter2b
2N/Agoto testParameter3
2N/A
2N/A:testParameter2b
2N/Aif not "%2" == "--restart" goto execute
2N/Agoto testParameter3
2N/A
2N/A:testParameter3
2N/Aif not "%3" == "" goto execute
2N/Aset NO_ARG_OR_ONLY_RESTART=1
2N/Agoto execute
2N/A
2N/A:execute
2N/Aif "%NO_ARG_OR_ONLY_RESTART%" == "0" goto stopWithLDAP
2N/A
2N/Arem Use the code in StopDS class to know if the server is already
2N/Arem stopped. An exit code of 99 means that the server is stopped.
2N/A"%JAVA_BIN%" %JAVA_ARGS% %SCRIPT_NAME_ARG% org.opends.server.tools.StopDS --checkStoppability
2N/Aif %errorlevel% == 99 goto serverStopped
2N/A
2N/Aif not exist "%DIR_HOME%\logs\server.pid" goto stopWithLDAP
2N/A"%DIR_HOME%\lib\winlauncher.exe" stop "%DIR_HOME%"
2N/Aif not %errorlevel% == 0 goto end
2N/A
2N/A:serverStopped
2N/Aif exist "%DIR_HOME%\logs\server.pid" erase "%DIR_HOME%\logs\server.pid"
2N/Aif "%RESTART%" == "1" "%DIR_HOME%\bin\start-ds.bat"
2N/Agoto end
2N/A
2N/A:stopWithLDAP
2N/Acall "%~dP0\_client-script.bat" %*
2N/A
2N/A:end
2N/A
2N/A