start-ds revision 3590
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj# CDDL HEADER START
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj# The contents of this file are subject to the terms of the
eb1349e4ab58bd2935f7054a1bfc5c86ab5a5fa3striker# Common Development and Distribution License, Version 1.0 only
a096f8d13bee05fd6ea8b9b50b6c2e818eace7d1striker# (the "License"). You may not use this file except in compliance
dba571e5c5a2586c7e2b382789f3250136ff7577jwoolley# with the License.
bf3d1782a29630335a1df535eb395355ab1cd154jwoolley# You can obtain a copy of the license at
07847078a10fe4e9229cc08adda5f421cafc0665jwoolley# trunk/opends/resource/legal-notices/OpenDS.LICENSE
d8028365066fca602bf35d014530a1802114378crbb# See the License for the specific language governing permissions
c25203fdca093d4504c51b4cd974ff60d5aa4fb1wrowe# and limitations under the License.
c25203fdca093d4504c51b4cd974ff60d5aa4fb1wrowe# When distributing Covered Code, include this CDDL HEADER in each
d89c116f82699294ca744125723651c554bc5925wrowe# file and include the License file at
4214e98fc9045e5010e66f9a967bd6d68f40d342aaron# trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
8721697e2aece27b0e738519329f7976c72b27bfjerenkrantz# add the following below this CDDL HEADER, with the fields enclosed
c25203fdca093d4504c51b4cd974ff60d5aa4fb1wrowe# by brackets "[]" replaced with your own identifying information:
91cacb801f6c0215b38322f6d2fc58cbfedfecfbjerenkrantz# Portions Copyright [yyyy] [name of copyright owner]
df14f0d3a5191cdd7c4bb5b03acd135d43a6f51brbb# CDDL HEADER END
571760de5e60c0b459cb11be45507b923cd023eejwoolley# Copyright 2006-2008 Sun Microsystems, Inc.
bcb6e1be6041dfeb549c8ea8d37f97ad4e90a0c3rbb# Capture the current working directory so that we can change to it later.
9bd71e35f5d26d26d23fe3a677401828e842ed72wrowe# Then capture the location of this script and the Directory Server instance
2900ab946a2d76b73a14cebfe2985d253f01c967stoddard# root so that we can use them to create appropriate paths.
2deb319e6b3de239f45c16a3e9e836d44f1f7108rbbcd "${WORKING_DIR}"
70f6f32765cfaadd6da8de6f0fea97ddd72d8fadmanoj# Specify the locations of important files that may be used when the server
2a6c49cfaef5979a5a06098f3ce987cd76769409manoj# is starting.
af4c982a7cf4515f124935f99a329744035fc699slive# Specify the script name so that it may be provided in command-line usage.
5ca8e11fadb6f7a8d9d0367c1800205c99d4bcd6jerenkrantz# Set environment variables
1b7e9aeb9867a1c94e24e8ae491d2dfcd0d225e3jerenkrantz. "${INSTANCE_ROOT}/lib/_script-util.sh"
f95a0b59eb24c631f15bd83e20c6cf823c432d83trawick# See if the provided set of arguments were sufficient for us to be able to
f95a0b59eb24c631f15bd83e20c6cf823c432d83trawick# start the server or perform the requested operation. An exit code of 99
418f39e60a288f855ec033b566744489c3bbbf39trawick# means that it should be possible to start the server. An exit code of 98
cc22a72861c58dda7f3768613aec864e4c4e0353striker# means that the server is already running and we shouldn't try to start it.
f95a0b59eb24c631f15bd83e20c6cf823c432d83trawick# An exit code of anything else means that we're not trying to start the server
ddafc111b94558ef4e2d7357ceda623315566ce3slive# and we can just exit with that exit code.
ddafc111b94558ef4e2d7357ceda623315566ce3slive${OPENDS_JAVA_BIN} ${SCRIPT_NAME_ARG} org.opends.server.core.DirectoryServer \
ae72c92fd41562d7c0e8627c093fcbbae4ac9ef2coar --configClass org.opends.server.extensions.ConfigFileHandler \
ddafc111b94558ef4e2d7357ceda623315566ce3slive --configFile "${CONFIG_FILE}" --checkStartability "${@}"
a4d9e6fdcd5d2ddd93a896b42a1d607ed258c316ianh # run detach
2fb49a1d25f38421a68d31b4cbb5d9293fdeafbewrowe nohup "${OPENDS_JAVA_BIN}" ${OPENDS_JAVA_ARGS} ${SCRIPT_NAME_ARG} \
f4cb04eb78da02a38fcdd87489dc7b660107d55fjerenkrantz --configClass org.opends.server.extensions.ConfigFileHandler \
f4cb04eb78da02a38fcdd87489dc7b660107d55fjerenkrantz --configFile "${CONFIG_FILE}" "${@}" > "${LOG_FILE}" 2>&1 &
2fb49a1d25f38421a68d31b4cbb5d9293fdeafbewrowe echo $! > "${PID_FILE}"
f4cb04eb78da02a38fcdd87489dc7b660107d55fjerenkrantz "${OPENDS_JAVA_BIN}" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete \
f4cb04eb78da02a38fcdd87489dc7b660107d55fjerenkrantz --targetFile "${STARTING_FILE}" --logFile "${LOG_FILE}"
f4cb04eb78da02a38fcdd87489dc7b660107d55fjerenkrantz "${OPENDS_JAVA_BIN}" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete \
f4cb04eb78da02a38fcdd87489dc7b660107d55fjerenkrantz # An exit code of 98 means that the server is already running.
2fb49a1d25f38421a68d31b4cbb5d9293fdeafbewrowe ${OPENDS_JAVA_BIN} ${SCRIPT_NAME_ARG} org.opends.server.core.DirectoryServer \
f4cb04eb78da02a38fcdd87489dc7b660107d55fjerenkrantz --configClass org.opends.server.extensions.ConfigFileHandler \
f4cb04eb78da02a38fcdd87489dc7b660107d55fjerenkrantz --configFile "${CONFIG_FILE}" --checkStartability > /dev/null 2>&1
82455c2e3b6991846fbcbf0c9e41f57dbc681217brianp # Could not start the server
b6bff62e5e6ae86726ec0b6445227f4852da8728aaron # run no detach
630f5fc1277582643fe0f831a4830e15127bd047jwoolley echo $$ > "${PID_FILE}"
630f5fc1277582643fe0f831a4830e15127bd047jwoolley exec "${OPENDS_JAVA_BIN}" ${OPENDS_JAVA_ARGS} ${SCRIPT_NAME_ARG} \
56b2562cb4041a21bc313fde3204beabdb758800jwoolley --configClass org.opends.server.extensions.ConfigFileHandler \
56b2562cb4041a21bc313fde3204beabdb758800jwoolley # run no detach quiet
f881b8be216de36c6b964324c772450bca38a4e6trawick echo $$ > "${PID_FILE}"
f881b8be216de36c6b964324c772450bca38a4e6trawick exec "${OPENDS_JAVA_BIN}" ${OPENDS_JAVA_ARGS} ${SCRIPT_NAME_ARG} \
f881b8be216de36c6b964324c772450bca38a4e6trawick --configClass org.opends.server.extensions.ConfigFileHandler \
b05930e6008f69bd323abe0c10f81f40ffd27983brianp # an error or the server is already started. Just return the code provided
b05930e6008f69bd323abe0c10f81f40ffd27983brianp # by checkstartability