6331N/A#!/bin/ksh93
6331N/A#
6331N/A# $Id$
479N/A#
479N/A# CDDL HEADER START
479N/A#
479N/A# The contents of this file are subject to the terms of the
479N/A# Common Development and Distribution License, Version 1.0 only
479N/A# (the "License"). You may not use this file except in compliance
479N/A# with the License.
479N/A#
479N/A# You can obtain a copy of the license at
479N/A# trunk/opends/resource/legal-notices/OpenDS.LICENSE
479N/A# or https://OpenDS.dev.java.net/OpenDS.LICENSE.
479N/A# See the License for the specific language governing permissions
479N/A# and limitations under the License.
479N/A#
479N/A# When distributing Covered Code, include this CDDL HEADER in each
479N/A# file and include the License file at
479N/A# trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
479N/A# add the following below this CDDL HEADER, with the fields enclosed
873N/A# by brackets "[]" replaced with your own identifying information:
479N/A# Portions Copyright [yyyy] [name of copyright owner]
479N/A#
479N/A# CDDL HEADER END
479N/A#
479N/A#
5236N/A# Copyright 2006-2010 Sun Microsystems, Inc.
5636N/A# Portions Copyright 2011 ForgeRock AS
6331N/A# Portions Copyright 2013 Jens Elkner
479N/A
479N/A# This script is used to invoke various server-side processes. It should not
479N/A# be invoked directly by end users.
6331N/A
6331N/A[[ ${FNTRACE} == 'ALL' || ${FNTRACE} == 'main' ]] && set -x
6331N/AINSTALL_ROOT="${.sh.file%/*/*}"
6331N/ACHECK=''
6331N/A
6331N/Atypeset -a MISC_ARGS=( )
6331N/Aif [[ -z ${OPENDJ_INVOKE_CLASS} || -z ${SCRIPT_NAME} ]]; then
6331N/A OIC=''
6331N/A SCRIPT_NAME=${.sh.file##*/}
6331N/A case "$SCRIPT_NAME" in
6331N/A dbtest) #link
6331N/A # debug JE backends in the Directory Server
6331N/A OIC='org.opends.server.tools.DBTest'
6331N/A CHECK='-i'
6331N/A ;;
6331N/A dsreplication) #link
6331N/A # perform some replication specific operations
6331N/A OIC='org.opends.server.tools.dsreplication.ReplicationCliMain'
6331N/A if [[ ${RECURSIVE_LOCAL_CALL} != 'true' ]]; then
6331N/A SCRIPT_ARGS+=' -Dorg.opends.server.dsreplicationcallstatus=firstcall'
6331N/A else
6331N/A SCRIPT_NAME='dsreplication.offline'
6331N/A SCRIPT_ARGS=${SCRIPT_ARGS//-Dorg.opends.server.dsreplicationcallstatus=firstcall}
6331N/A fi
6331N/A ;;
6331N/A encode-password) #link
6331N/A # encode clear-text passwords or verify whether a given clear-text
6331N/A # password matches a provided encoded password
6331N/A OIC='org.opends.server.tools.EncodePassword'
6331N/A ;;
6331N/A ldif-diff) #link
6331N/A # compare the contents of two LDIF files
6331N/A OIC='org.opends.server.tools.LDIFDiff'
6331N/A ;;
6331N/A ldifmodify) #link
6331N/A # alter the contents of an LDIF file
6331N/A OIC='org.opends.server.tools.LDIFModify'
6331N/A ;;
6331N/A ldifsearch) #link
6331N/A # perform searches in an LDIF file
6331N/A OIC='org.opends.server.tools.LDIFSearch'
6331N/A ;;
6331N/A list-backends) #link
6331N/A # perform a restore of a Directory Server backend
6331N/A OIC='org.opends.server.tools.ListBackends'
6331N/A CHECK='-i'
6331N/A ;;
6331N/A make-ldif) #link
6331N/A # generate LDIF data based on a provided template
6331N/A #NO_CHECK=1
6331N/A MISC_ARGS+=( '--resourcePath' "${INSTANCE_ROOT}/config/MakeLDIF" )
6331N/A OIC='org.opends.server.tools.makeldif.MakeLDIF'
6331N/A ;;
6331N/A rebuild-index) #link
6331N/A # rebuild the contents of a Directory Server backend storing its
6331N/A # data in the Berkeley DB Java Edition
6331N/A OIC='org.opends.server.tools.RebuildIndex'
6331N/A ;;
6331N/A upgrade)
6331N/A OIC='org.opends.server.tools.upgrade.UpgradeCli'
6331N/A INSTALL_ROOT="${.sh.file%/*}"
6331N/A CHECK='-i'
6331N/A ;;
6331N/A verify-index) #link
6331N/A # perform validation on the contents of a Directory Server backend
6331N/A # storing its data in the Berkeley DB Java Edition
6331N/A OIC='org.opends.server.tools.VerifyIndex'
6331N/A CHECK='-i'
6331N/A ;;
6331N/A esac
6331N/A OPENDJ_INVOKE_CLASS=${OIC}
479N/Afi
479N/A
6331N/Aif [[ -z ${OPENDJ_INVOKE_CLASS} ]]; then
6331N/A print -u2 'ERROR: OPENDJ_INVOKE_CLASS environment variable is not set.'
6331N/A exit 1
6331N/Afi
619N/A
2976N/A# Set environment variables
6331N/A. "${INSTALL_ROOT}/lib/_script-util.sh"
6331N/AcheckEnv ${CHECK} 'set-full-environment' "$@"
479N/A
479N/A# Launch the appropriate server utility.
6331N/A"${OPENDJ_JAVA_BIN}" ${OPENDJ_JAVA_ARGS} ${SCRIPT_ARGS} ${SCRIPT_NAME_ARG} \
6331N/A -Dorg.opends.server.InstallRoot="${INSTALL_ROOT}" \
6331N/A -Dorg.opends.server.InstanceRoot="${INSTANCE_ROOT}" \
6331N/A ${OPENDJ_INVOKE_CLASS} \
6331N/A --configClass org.opends.server.extensions.ConfigFileHandler \
6331N/A --configFile "${INSTANCE_ROOT}"/config/config.ldif "${MISC_ARGS[@]}" "$@"