start-ds revision a3d3ab94806056d2355afea6fe8daac41059b9fb
1965c5d21403c3d66eb1efa29c670378311b1077Paul Bryan# CDDL HEADER START
1965c5d21403c3d66eb1efa29c670378311b1077Paul Bryan# The contents of this file are subject to the terms of the
1965c5d21403c3d66eb1efa29c670378311b1077Paul Bryan# Common Development and Distribution License, Version 1.0 only
1965c5d21403c3d66eb1efa29c670378311b1077Paul Bryan# (the "License"). You may not use this file except in compliance
1965c5d21403c3d66eb1efa29c670378311b1077Paul Bryan# with the License.
1965c5d21403c3d66eb1efa29c670378311b1077Paul Bryan# You can obtain a copy of the license at
1965c5d21403c3d66eb1efa29c670378311b1077Paul Bryan# trunk/opends/resource/legal-notices/OpenDS.LICENSE
1965c5d21403c3d66eb1efa29c670378311b1077Paul Bryan# See the License for the specific language governing permissions
1965c5d21403c3d66eb1efa29c670378311b1077Paul Bryan# and limitations under the License.
1965c5d21403c3d66eb1efa29c670378311b1077Paul Bryan# When distributing Covered Code, include this CDDL HEADER in each
4eb529f0471672590d77cf89ef23987ba2c95ff4Laszlo Hordos# file and include the License file at
4eb529f0471672590d77cf89ef23987ba2c95ff4Laszlo Hordos# trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
1965c5d21403c3d66eb1efa29c670378311b1077Paul Bryan# add the following below this CDDL HEADER, with the fields enclosed
1965c5d21403c3d66eb1efa29c670378311b1077Paul Bryan# by brackets "[]" replaced with your own identifying information:
1965c5d21403c3d66eb1efa29c670378311b1077Paul Bryan# Portions Copyright [yyyy] [name of copyright owner]
1965c5d21403c3d66eb1efa29c670378311b1077Paul Bryan# CDDL HEADER END
7c64421614d420f1951773af3ce6a6111cef84b2Jake Feasel# Copyright 2006-2008 Sun Microsystems, Inc.
b564baaca75789be41eba24bb96e31f3ce5b10eeJake Feasel# Capture the current working directory so that we can change to it later.
7c64421614d420f1951773af3ce6a6111cef84b2Jake Feasel# Then capture the location of this script and the Directory Server instance
1965c5d21403c3d66eb1efa29c670378311b1077Paul Bryan# root so that we can use them to create appropriate paths.
e5c203467ee4398ae81a6adb63da7477451b2e77Laszlo Hordoscd "${WORKING_DIR}"
e5c203467ee4398ae81a6adb63da7477451b2e77Laszlo Hordos# Specify the locations of important files that may be used when the server
e5c203467ee4398ae81a6adb63da7477451b2e77Laszlo Hordos# is starting.
e5c203467ee4398ae81a6adb63da7477451b2e77Laszlo HordosCONFIG_FILE=${INSTANCE_ROOT}/config/config.ldif
e5c203467ee4398ae81a6adb63da7477451b2e77Laszlo HordosSTARTING_FILE=${INSTANCE_ROOT}/logs/server.starting
8166b048bd3e2106dbdeaa1a2b8a728952d788f4Laszlo Hordos# Specify the script name so that it may be provided in command-line usage.
8166b048bd3e2106dbdeaa1a2b8a728952d788f4Laszlo Hordos# Set environment variables
8166b048bd3e2106dbdeaa1a2b8a728952d788f4Laszlo HordosSCRIPT_UTIL_CMD=set-full-environment-and-test-java
8166b048bd3e2106dbdeaa1a2b8a728952d788f4Laszlo Hordos. "${INSTANCE_ROOT}/lib/_script-util.sh"
73bedec6a263fc6f6a15e58fb55eb1f2045b85a8Bruno Lavit# See if the provided set of arguments were sufficient for us to be able to
73bedec6a263fc6f6a15e58fb55eb1f2045b85a8Bruno Lavit# start the server or perform the requested operation. An exit code of 99
73bedec6a263fc6f6a15e58fb55eb1f2045b85a8Bruno Lavit# means that it should be possible to start the server. An exit code of 98
a14db14686bf9f6817c47e5c14e887d74dd615f0Laszlo Hordos# means that the server is already running and we shouldn't try to start it.
13ec3d949d0a30c6d8fa0b899f583d64164f37f3Chris Drake# An exit code of anything else means that we're not trying to start the server
f85a185a657def022f6d8896cc755403f7d40694Andi Egloff# and we can just exit with that exit code.
a14db14686bf9f6817c47e5c14e887d74dd615f0Laszlo Hordos${OPENDS_JAVA_BIN} ${SCRIPT_NAME_ARG} org.opends.server.core.DirectoryServer \
2d7019e19039fd083850f76e54b6b26a7b06a8f2yaromin --configClass org.opends.server.extensions.ConfigFileHandler \
2d7019e19039fd083850f76e54b6b26a7b06a8f2yaromin --configFile "${CONFIG_FILE}" --checkStartability "${@}"
2d7019e19039fd083850f76e54b6b26a7b06a8f2yaromin # run detach
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel nohup "${OPENDS_JAVA_BIN}" ${OPENDS_JAVA_ARGS} ${SCRIPT_NAME_ARG} \
660a40ad15749d74efa0dd4ef12cb8781c570e22Laszlo Hordos --configClass org.opends.server.extensions.ConfigFileHandler \
660a40ad15749d74efa0dd4ef12cb8781c570e22Laszlo Hordos --configFile "${CONFIG_FILE}" "${@}" > "${LOG_FILE}" 2>&1 &
660a40ad15749d74efa0dd4ef12cb8781c570e22Laszlo Hordos echo $! > "${PID_FILE}"
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "${OPENDS_JAVA_BIN}" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete \
660a40ad15749d74efa0dd4ef12cb8781c570e22Laszlo Hordos --targetFile "${STARTING_FILE}" --logFile "${LOG_FILE}"
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel "${OPENDS_JAVA_BIN}" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete \
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel # An exit code of 98 means that the server is already running.
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel ${OPENDS_JAVA_BIN} ${SCRIPT_NAME_ARG} org.opends.server.core.DirectoryServer \
660a40ad15749d74efa0dd4ef12cb8781c570e22Laszlo Hordos --configClass org.opends.server.extensions.ConfigFileHandler \
660a40ad15749d74efa0dd4ef12cb8781c570e22Laszlo Hordos --configFile "${CONFIG_FILE}" --checkStartability > /dev/null 2>&1
660a40ad15749d74efa0dd4ef12cb8781c570e22Laszlo Hordos # Could not start the server
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel # run no detach
660a40ad15749d74efa0dd4ef12cb8781c570e22Laszlo Hordos echo $$ > "${PID_FILE}"
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel exec "${OPENDS_JAVA_BIN}" ${OPENDS_JAVA_ARGS} ${SCRIPT_NAME_ARG} \
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel --configClass org.opends.server.extensions.ConfigFileHandler \
7d83b6a03bd7b63f2eb6404d6cc1e4c074391ea7Jake Feasel # an error or the server is already started. Just return the code provided
660a40ad15749d74efa0dd4ef12cb8781c570e22Laszlo Hordos # by checkstartability