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