0N/Arem CDDL HEADER START
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 You can obtain a copy of the license at
0N/Arem See the License for the specific language governing permissions
0N/Arem and limitations under the License.
0N/Arem When distributing Covered Code, include this CDDL HEADER in each
0N/Arem file and include the License file at
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]
5065N/Arem Copyright 2006-2010 Sun Microsystems, Inc.
5636N/Arem Portions Copyright 2011 ForgeRock AS
1920N/Afor %%i in (%~sf0) do set DIR_HOME=%%~dPsi..
3196N/Arem We keep this values to reset the environment before calling start-ds.
5636N/Aset ORIGINAL_JAVA_ARGS=%OPENDJ_JAVA_ARGS%
5636N/Aset ORIGINAL_JAVA_HOME=%OPENDJ_JAVA_HOME%
5636N/Aset ORIGINAL_JAVA_BIN=%OPENDJ_JAVA_BIN%
1298N/Arem This is the template to use for logging. Make sure to use >>
1298N/Arem echo %SCRIPT%: your-message-here >> %LOG%
1298N/Aecho %SCRIPT%: invoked >> %LOG%
2976N/Arem Set environment variables
2976N/Aset SCRIPT_UTIL_CMD=set-full-environment-and-test-java
2976N/Aif NOT %errorlevel% == 0 exit /B %errorlevel%
1298N/Aecho %SCRIPT%: CLASSPATH=%CLASSPATH% >> %LOG%
961N/Aif %errorlevel% == 98 goto serverAlreadyStopped
961N/Aif %errorlevel% == 99 goto startUsingSystemCall
961N/Aif %errorlevel% == 100 goto stopUsingSystemCall
961N/Aif %errorlevel% == 101 goto restartUsingSystemCall
961N/Aif %errorlevel% == 102 goto stopUsingProtocol
961N/Aif %errorlevel% == 103 goto stopAsWindowsService
961N/Aif %errorlevel% == 104 goto restartAsWindowsService
961N/Arem An error or we display usage
1298N/Aecho %SCRIPT%: server already stopped >> %LOG%
1298N/Aecho %SCRIPT%: start using system call >> %LOG%
3196N/Arem Set the original values that the user had on the environment in order to be
3196N/Arem sure that the start-ds script works with the proper arguments (in particular
3196N/Arem if the user specified not to overwrite the environment).
5636N/Aset OPENDJ_JAVA_ARGS=%ORIGINAL_JAVA_ARGS%
5636N/Aset OPENDJ_JAVA_HOME=%ORIGINAL_JAVA_HOME%
5636N/Aset OPENDJ_JAVA_BIN=%ORIGINAL_JAVA_BIN%
1298N/Aecho %SCRIPT%: stop using system call >> %LOG%
1298N/Aecho %SCRIPT%: restart using system call >> %LOG%
832N/Aif not %errorlevel% == 0 goto end
961N/Agoto startUsingSystemCall
1298N/Aecho %SCRIPT%: stop using protocol >> %LOG%
1298N/Aecho %SCRIPT%: stop as windows service >> %LOG%
961N/A:restartAsWindowsService
1298N/Aecho %SCRIPT%: restart as windows service, stopping >> %LOG%
961N/Aif not %errorlevel% == 0 goto end
1298N/Aecho %SCRIPT%: restart as windows service, starting >> %LOG%
5065N/Aecho %SCRIPT%: finished >> %LOG%