start-ds revision 6983
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# CDDL HEADER START
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# The contents of this file are subject to the terms of the
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# Common Development and Distribution License, Version 1.0 only
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# (the "License"). You may not use this file except in compliance
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# with the License.
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# See the License for the specific language governing permissions
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# and limitations under the License.
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# When distributing Covered Code, include this CDDL HEADER in each
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# file and include the License file at legal-notices/CDDLv1_0.txt.
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# If applicable, add the following below this CDDL HEADER, with the
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# fields enclosed by brackets "[]" replaced with your own identifying
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# information:
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# Portions Copyright [yyyy] [name of copyright owner]
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# CDDL HEADER END
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# Copyright 2006-2009 Sun Microsystems, Inc.
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# Portions Copyright 2011-2013 ForgeRock AS
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# Capture the current working directory so that we can change to it later.
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# Then capture the location of this script and the Directory Server instance
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# root so that we can use them to create appropriate paths.
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipecd "${WORKING_DIR}"
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# Specify the script name so that it may be provided in command-line usage.
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# check for presence of lib/_svc-opendj.sh file
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# If present, we should be on Solaris/OpenSolaris and use SMF to start
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# Check --exec. If not present, start OpenDJ from SMF
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipeif test -f "${INSTALL_ROOT}/lib/_svc-opendj.sh"
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe elif [ -z "$1" -o "$1" = "-L" -o "$1" = "-Q" -o "$1" = "-N" -o \
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe "$1" = "--nodetach" -o "$1" = "-useLastKnownGoodConfig" \
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# these options are only used when trying to start the server
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# In this case, start it through the service.
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe exec /usr/sbin/svcadm enable -t svc:/network/ldap/server:opendj
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# Set environment variables
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe. "${INSTALL_ROOT}/lib/_script-util.sh"
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# Specify the locations of important files that may be used when the server
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# is starting.
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# See if the provided set of arguments were sufficient for us to be able to
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# start the server or perform the requested operation. An exit code of 99
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# means that it should be possible to start the server. An exit code of 98
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# means that the server is already running and we shouldn't try to start it.
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# An exit code of anything else means that we're not trying to start the server
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe# and we can just exit with that exit code.
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe"${OPENDJ_JAVA_BIN}" -client ${SCRIPT_NAME_ARG} org.opends.server.core.DirectoryServer \
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe --configClass org.opends.server.extensions.ConfigFileHandler \
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe --configFile "${CONFIG_FILE}" --checkStartability "${@}"
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe # run detach
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe nohup "${OPENDJ_JAVA_BIN}" ${OPENDJ_JAVA_ARGS} ${SCRIPT_NAME_ARG} \
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe --configClass org.opends.server.extensions.ConfigFileHandler \
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe --configFile "${CONFIG_FILE}" "${@}" > "${LOG_FILE}" 2>&1 &
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe echo $! > "${PID_FILE}"
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe "${OPENDJ_JAVA_BIN}" -client org.opends.server.tools.WaitForFileDelete \
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe --targetFile "${STARTING_FILE}" --logFile "${LOG_FILE}" "${@}"
4edb61f8b0f8ce9f62d803c706612376498672b4al_xipe "${OPENDJ_JAVA_BIN}" -client org.opends.server.tools.WaitForFileDelete \
EC=${?}
exit ${EC}
exit ${EC}