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