start-ds revision 2976
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj# CDDL HEADER START
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj# The contents of this file are subject to the terms of the
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj# Common Development and Distribution License, Version 1.0 only
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj# (the "License"). You may not use this file except in compliance
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj# with the License.
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj# You can obtain a copy of the license at
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj# See the License for the specific language governing permissions
4065b438067f3f08d0bd98b31ac4085b581b931dstoddard# and limitations under the License.
7ba24263a36323ecaf0685758f44001c0800d012stoddard# When distributing Covered Code, include this CDDL HEADER in each
7ba24263a36323ecaf0685758f44001c0800d012stoddard# file and include the License file at
7ba24263a36323ecaf0685758f44001c0800d012stoddard# trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
4065b438067f3f08d0bd98b31ac4085b581b931dstoddard# add the following below this CDDL HEADER, with the fields enclosed
2739add8add66e21526ce27f83c2ae133d089070rbb# by brackets "[]" replaced with your own identifying information:
2739add8add66e21526ce27f83c2ae133d089070rbb# Portions Copyright [yyyy] [name of copyright owner]
211bf1d44f4653bf753a15740cd5ebbf330b6e93manoj# CDDL HEADER END
7ba24263a36323ecaf0685758f44001c0800d012stoddard# Portions Copyright 2006-2007 Sun Microsystems, Inc.
7ba24263a36323ecaf0685758f44001c0800d012stoddard# Capture the current working directory so that we can change to it later.
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj# Then capture the location of this script and the Directory Server instance
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj# root so that we can use them to create appropriate paths.
9c09943bad734ebd5c7cc10bd6d63b75c4c6e056stoddardcd "${WORKING_DIR}"
9c09943bad734ebd5c7cc10bd6d63b75c4c6e056stoddard# Specify the locations of important files that may be used when the server
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj# is starting.
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj# Specify the script name so that it may be provided in command-line usage.
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj# Set environment variables
56ca30c968906053ae61acb218420667bb58d996rbb. "${INSTANCE_ROOT}/lib/_script-util.sh"
7ba24263a36323ecaf0685758f44001c0800d012stoddard# See if the provided set of arguments were sufficient for us to be able to
7ba24263a36323ecaf0685758f44001c0800d012stoddard# start the server or perform the requested operation. An exit code of 99
9c09943bad734ebd5c7cc10bd6d63b75c4c6e056stoddard# means that it should be possible to start the server. An exit code of 98
9c09943bad734ebd5c7cc10bd6d63b75c4c6e056stoddard# means that the server is already running and we shouldn't try to start it.
9c09943bad734ebd5c7cc10bd6d63b75c4c6e056stoddard# An exit code of anything else means that we're not trying to start the server
9c09943bad734ebd5c7cc10bd6d63b75c4c6e056stoddard# and we can just exit with that exit code.
9c09943bad734ebd5c7cc10bd6d63b75c4c6e056stoddard${OPENDS_JAVA_BIN} ${SCRIPT_NAME_ARG} org.opends.server.core.DirectoryServer \
9c09943bad734ebd5c7cc10bd6d63b75c4c6e056stoddard --configClass org.opends.server.extensions.ConfigFileHandler \
9c09943bad734ebd5c7cc10bd6d63b75c4c6e056stoddard --configFile "${CONFIG_FILE}" --checkStartability "${@}"
9c09943bad734ebd5c7cc10bd6d63b75c4c6e056stoddard # run detach
9c09943bad734ebd5c7cc10bd6d63b75c4c6e056stoddard nohup "${OPENDS_JAVA_BIN}" ${OPENDS_JAVA_ARGS} ${SCRIPT_NAME_ARG} \
aa1faea36e4ae357bc603a2337b6adc54f5daec1manoj --configClass org.opends.server.extensions.ConfigFileHandler \
aa1faea36e4ae357bc603a2337b6adc54f5daec1manoj --configFile "${CONFIG_FILE}" "${@}" > "${LOG_FILE}" 2>&1 &
aa1faea36e4ae357bc603a2337b6adc54f5daec1manoj echo $! > "${PID_FILE}"
302dc1f7b3feee23a91ad8f3cf3cb2edd95a557bmanoj "${OPENDS_JAVA_BIN}" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete \
302dc1f7b3feee23a91ad8f3cf3cb2edd95a557bmanoj --targetFile "${STARTING_FILE}" --logFile "${LOG_FILE}"
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj "${OPENDS_JAVA_BIN}" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete \
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj # An exit code of 98 means that the server is already running.
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj ${OPENDS_JAVA_BIN} ${SCRIPT_NAME_ARG} org.opends.server.core.DirectoryServer \
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj --configClass org.opends.server.extensions.ConfigFileHandler \
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj --configFile "${CONFIG_FILE}" --checkStartability > /dev/null 2>&1
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj # Could not start the server
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj # run no detach
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj echo $$ > "${PID_FILE}"
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj exec "${OPENDS_JAVA_BIN}" ${OPENDS_JAVA_ARGS} ${SCRIPT_NAME_ARG} \
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj --configClass org.opends.server.extensions.ConfigFileHandler \
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj # an error or the server is already started. Just return the code provided
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj # by checkstartability