_mixed-script.sh revision 2976
0N/A#!/bin/sh
196N/A#
0N/A# CDDL HEADER START
0N/A#
0N/A# The contents of this file are subject to the terms of the
0N/A# Common Development and Distribution License, Version 1.0 only
0N/A# (the "License"). You may not use this file except in compliance
0N/A# with the License.
0N/A#
0N/A# You can obtain a copy of the license at
0N/A# trunk/opends/resource/legal-notices/OpenDS.LICENSE
0N/A# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
0N/A# See the License for the specific language governing permissions
0N/A# and limitations under the License.
0N/A#
0N/A# When distributing Covered Code, include this CDDL HEADER in each
0N/A# file and include the License file at
0N/A# trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
0N/A# add the following below this CDDL HEADER, with the fields enclosed
0N/A# by brackets "[]" replaced with your own identifying information:
0N/A# Portions Copyright [yyyy] [name of copyright owner]
0N/A#
0N/A# CDDL HEADER END
0N/A#
0N/A#
0N/A# Portions Copyright 2007 Sun Microsystems, Inc.
0N/A
0N/A
0N/A# This script is used to invoke processes that might be run on server or
0N/A# in client mode (depending on the state of the server and the arguments
0N/A# passed). It should not be invoked directly by end users.
0N/Aif test -z "${OPENDS_INVOKE_CLASS}"
0N/Athen
0N/A echo "ERROR: OPENDS_INVOKE_CLASS environment variable is not set."
0N/A exit 1
0N/Afi
0N/A
0N/A
0N/A# Capture the current working directory so that we can change to it later.
0N/A# Then capture the location of this script and the Directory Server instance
0N/A# root so that we can use them to create appropriate paths.
0N/AWORKING_DIR=`pwd`
0N/A
0N/Acd `dirname "${0}"`
0N/ASCRIPT_DIR=`pwd`
0N/A
0N/Acd ..
0N/AINSTANCE_ROOT=`pwd`
0N/Aexport INSTANCE_ROOT
0N/A
0N/Acd "${WORKING_DIR}"
0N/A
0N/AOLD_SCRIPT_NAME=${SCRIPT_NAME}
0N/ASCRIPT_NAME=${OLD_SCRIPT_NAME}.online
0N/Aexport SCRIPT_NAME
0N/A
63N/A# Set environment variables
63N/ASCRIPT_UTIL_CMD=set-full-environment
0N/Aexport SCRIPT_UTIL_CMD
63N/A. "${INSTANCE_ROOT}/lib/_script-util.sh"
63N/ARETURN_CODE=$?
63N/Aif test ${RETURN_CODE} -ne 0
63N/Athen
63N/A exit ${RETURN_CODE}
63N/Afi
63N/A
63N/AMUST_CALL_AGAIN="false"
63N/A
63N/ASCRIPT_NAME_ARG=-Dorg.opends.server.scriptName=${OLD_SCRIPT_NAME}
63N/Aexport SCRIPT_NAME_ARG
63N/A
0N/A# Check whether is local or remote
63N/A"${OPENDS_JAVA_BIN}" ${OPENDS_JAVA_ARGS} ${SCRIPT_NAME_ARG} "${OPENDS_INVOKE_CLASS}" \
0N/A --configClass org.opends.server.extensions.ConfigFileHandler \
0N/A --configFile "${INSTANCE_ROOT}/config/config.ldif" --testIfOffline "${@}"
0N/AEC=${?}
0N/Aif test ${EC} -eq 51
0N/Athen
0N/A # Set the environment to use the offline properties
63N/A SCRIPT_NAME=${OLD_SCRIPT_NAME}.offline
0N/A export SCRIPT_NAME
0N/A . "${INSTANCE_ROOT}/lib/_script-util.sh"
0N/A RETURN_CODE=$?
0N/A if test ${RETURN_CODE} -ne 0
0N/A then
0N/A exit ${RETURN_CODE}
0N/A fi
0N/A MUST_CALL_AGAIN="true"
0N/Aelse
0N/A if test ${EC} -eq 52
0N/A then
0N/A MUST_CALL_AGAIN="true"
0N/A fi
0N/Afi
0N/A
0N/Aif test ${MUST_CALL_AGAIN} = "true"
0N/Athen
0N/A SCRIPT_NAME_ARG=-Dorg.opends.server.scriptName=${OLD_SCRIPT_NAME}
0N/A export SCRIPT_NAME_ARG
0N/A
0N/A # Launch the server utility.
0N/A "${OPENDS_JAVA_BIN}" ${OPENDS_JAVA_ARGS} ${SCRIPT_NAME_ARG} "${OPENDS_INVOKE_CLASS}" \
0N/A --configClass org.opends.server.extensions.ConfigFileHandler \
0N/A --configFile "${INSTANCE_ROOT}/config/config.ldif" "${@}"
0N/Afi
0N/A