2976N/A#!/bin/sh
2976N/A#
2976N/A# CDDL HEADER START
2976N/A#
2976N/A# The contents of this file are subject to the terms of the
2976N/A# Common Development and Distribution License, Version 1.0 only
2976N/A# (the "License"). You may not use this file except in compliance
2976N/A# with the License.
2976N/A#
2976N/A# You can obtain a copy of the license at
2976N/A# trunk/opends/resource/legal-notices/OpenDS.LICENSE
2976N/A# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
2976N/A# See the License for the specific language governing permissions
2976N/A# and limitations under the License.
2976N/A#
2976N/A# When distributing Covered Code, include this CDDL HEADER in each
2976N/A# file and include the License file at
2976N/A# trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
2976N/A# add the following below this CDDL HEADER, with the fields enclosed
2976N/A# by brackets "[]" replaced with your own identifying information:
2976N/A# Portions Copyright [yyyy] [name of copyright owner]
2976N/A#
2976N/A# CDDL HEADER END
2976N/A#
2976N/A#
5236N/A# Copyright 2008-2010 Sun Microsystems, Inc.
6238N/A# Portions Copyright 2011-2013 ForgeRock AS
2976N/A
2976N/A
2976N/A# This script is used to invoke processes that might be run on server or
2976N/A# in client mode (depending on the state of the server and the arguments
2976N/A# passed). It should not be invoked directly by end users.
5636N/Aif test -z "${OPENDJ_INVOKE_CLASS}"
2976N/Athen
5636N/A echo "ERROR: OPENDJ_INVOKE_CLASS environment variable is not set."
2976N/A exit 1
2976N/Afi
2976N/A
2976N/A
2976N/A# Capture the current working directory so that we can change to it later.
3824N/A# Then capture the location of this script and the Directory Server install
3824N/A# and instance root so that we can use them to create appropriate paths.
2976N/AWORKING_DIR=`pwd`
2976N/A
3488N/Acd "`dirname "${0}"`"
2976N/ASCRIPT_DIR=`pwd`
2976N/A
2976N/Acd ..
3824N/AINSTALL_ROOT=`pwd`
3824N/Aexport INSTALL_ROOT
3824N/A
2976N/Acd "${WORKING_DIR}"
2976N/A
2976N/AOLD_SCRIPT_NAME=${SCRIPT_NAME}
2976N/ASCRIPT_NAME=${OLD_SCRIPT_NAME}.online
2976N/Aexport SCRIPT_NAME
2976N/A
3262N/A# We keep this values to reset the environment before calling _script-util.sh
3262N/A# for the second time.
5636N/AORIGINAL_JAVA_ARGS=${OPENDJ_JAVA_ARGS}
5636N/AORIGINAL_JAVA_HOME=${OPENDJ_JAVA_HOME}
5636N/AORIGINAL_JAVA_BIN=${OPENDJ_JAVA_BIN}
3262N/A
2976N/A# Set environment variables
2976N/ASCRIPT_UTIL_CMD=set-full-environment
2976N/Aexport SCRIPT_UTIL_CMD
3824N/A. "${INSTALL_ROOT}/lib/_script-util.sh"
2976N/ARETURN_CODE=$?
2976N/Aif test ${RETURN_CODE} -ne 0
2976N/Athen
2976N/A exit ${RETURN_CODE}
2976N/Afi
2976N/A
2976N/AMUST_CALL_AGAIN="false"
2976N/A
2976N/ASCRIPT_NAME_ARG=-Dorg.opends.server.scriptName=${OLD_SCRIPT_NAME}
2976N/Aexport SCRIPT_NAME_ARG
2976N/A
2976N/A# Check whether is local or remote
5636N/A"${OPENDJ_JAVA_BIN}" ${OPENDJ_JAVA_ARGS} ${SCRIPT_ARGS} ${SCRIPT_NAME_ARG} "${OPENDJ_INVOKE_CLASS}" \
2976N/A --configClass org.opends.server.extensions.ConfigFileHandler \
5636N/A --configFile "${INSTANCE_ROOT}/config/config.ldif" --testIfOffline "${@}"
2976N/AEC=${?}
2976N/Aif test ${EC} -eq 51
2976N/Athen
3262N/A # Set the original values that the user had on the environment in order to be
3262N/A # sure that the script works with the proper arguments (in particular
3262N/A # if the user specified not to overwrite the environment).
5636N/A OPENDJ_JAVA_ARGS=${ORIGINAL_JAVA_ARGS}
5636N/A OPENDJ_JAVA_HOME=${ORIGINAL_JAVA_HOME}
5636N/A OPENDJ_JAVA_BIN=${ORIGINAL_JAVA_BIN}
3262N/A
2976N/A # Set the environment to use the offline properties
2976N/A SCRIPT_NAME=${OLD_SCRIPT_NAME}.offline
2976N/A export SCRIPT_NAME
3824N/A . "${INSTALL_ROOT}/lib/_script-util.sh"
2976N/A RETURN_CODE=$?
2976N/A if test ${RETURN_CODE} -ne 0
2976N/A then
2976N/A exit ${RETURN_CODE}
2976N/A fi
2976N/A MUST_CALL_AGAIN="true"
2976N/Aelse
2976N/A if test ${EC} -eq 52
2976N/A then
2976N/A MUST_CALL_AGAIN="true"
3440N/A else
3440N/A # This is likely a problem with the provided arguments.
3440N/A exit ${EC}
2976N/A fi
2976N/Afi
2976N/A
2976N/Aif test ${MUST_CALL_AGAIN} = "true"
2976N/Athen
2976N/A SCRIPT_NAME_ARG=-Dorg.opends.server.scriptName=${OLD_SCRIPT_NAME}
2976N/A export SCRIPT_NAME_ARG
5636N/A
2976N/A # Launch the server utility.
5636N/A "${OPENDJ_JAVA_BIN}" ${OPENDJ_JAVA_ARGS} ${SCRIPT_ARGS} ${SCRIPT_NAME_ARG} "${OPENDJ_INVOKE_CLASS}" \
2976N/A --configClass org.opends.server.extensions.ConfigFileHandler \
2976N/A --configFile "${INSTANCE_ROOT}/config/config.ldif" "${@}"
2976N/Afi