stop-ds.bat revision 2976
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/Afor %%i in (%~sf0) do set DIR_HOME=%%~dPsi..
2N/A
2N/Aset INSTANCE_ROOT=%DIR_HOME%
2N/A
2N/Aset LOG="%INSTANCE_ROOT%\logs\native-windows.out"
2N/Aset SCRIPT=stop-ds.bat
2N/A
2N/Arem This is the template to use for logging. Make sure to use >>
2N/Arem echo %SCRIPT%: your-message-here >> %LOG%
2N/Aecho %SCRIPT%: invoked >> %LOG%
2N/A
2N/Aset SCRIPT_NAME=start-ds
2N/A
2N/Arem Set environment variables
2N/Aset SCRIPT_UTIL_CMD=set-full-environment-and-test-java
2N/Acall "%INSTANCE_ROOT%\lib\_script-util.bat"
2N/Aif NOT %errorlevel% == 0 exit /B %errorlevel%
2N/A
2N/Aecho %SCRIPT%: CLASSPATH=%CLASSPATH% >> %LOG%
2N/A
2N/A"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M %SCRIPT_NAME_ARG% org.opends.server.tools.StopDS --checkStoppability %*
2N/A
2N/Aif %errorlevel% == 98 goto serverAlreadyStopped
2N/Aif %errorlevel% == 99 goto startUsingSystemCall
2N/Aif %errorlevel% == 100 goto stopUsingSystemCall
2N/Aif %errorlevel% == 101 goto restartUsingSystemCall
2N/Aif %errorlevel% == 102 goto stopUsingProtocol
2N/Aif %errorlevel% == 103 goto stopAsWindowsService
2N/Aif %errorlevel% == 104 goto restartAsWindowsService
2N/Arem An error or we display usage
2N/Agoto end
2N/A
2N/A:serverAlreadyStopped
2N/Aecho %SCRIPT%: server already stopped >> %LOG%
2N/Aif exist "%DIR_HOME%\logs\server.pid" erase "%DIR_HOME%\logs\server.pid"
2N/Agoto end
2N/A
2N/A:startUsingSystemCall
2N/Aecho %SCRIPT%: start using system call >> %LOG%
2N/A"%DIR_HOME%\bat\start-ds.bat"
2N/Agoto end
2N/A
2N/A:stopUsingSystemCall
2N/Aecho %SCRIPT%: stop using system call >> %LOG%
2N/A"%DIR_HOME%\lib\winlauncher.exe" stop "%DIR_HOME%"
2N/Agoto end
2N/A
2N/A:restartUsingSystemCall
2N/Aecho %SCRIPT%: restart using system call >> %LOG%
2N/A"%DIR_HOME%\lib\winlauncher.exe" stop "%DIR_HOME%"
2N/Aif not %errorlevel% == 0 goto end
2N/Agoto startUsingSystemCall
2N/A
2N/A:stopUsingProtocol
2N/Aecho %SCRIPT%: stop using protocol >> %LOG%
2N/Acall "%DIR_HOME%\lib\_client-script.bat" %*
2N/Agoto end
2N/A
2N/A:stopAsWindowsService
2N/Aecho %SCRIPT%: stop as windows service >> %LOG%
2N/A"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.StopWindowsService
2N/Agoto end
2N/A
2N/A:restartAsWindowsService
2N/Aecho %SCRIPT%: restart as windows service, stopping >> %LOG%
2N/A"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.StopWindowsService
2N/Aif not %errorlevel% == 0 goto end
2N/Aecho %SCRIPT%: restart as windows service, starting >> %LOG%
2N/A"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.StartWindowsService
2N/A"%OPENDS_JAVA_BIN%" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete --targetFile "%DIR_HOME%\logs\server.startingservice"
2N/Arem Type the contents the winwervice.out file and delete it.
2N/Aif exist "%DIR_HOME%\logs\winservice.out" type "%DIR_HOME%\logs\winservice.out"
2N/Aif exist "%DIR_HOME%\logs\winservice.out" erase "%DIR_HOME%\logs\winservice.out"
2N/Agoto end
2N/A
2N/A:end
2N/A
2N/Aecho %SCRIPT%: finished >> %LOG%
2N/A