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