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