start-ds revision 619
4bc1bbf45f30ff3ca38c2ad006836e490972c7ccvboxsync# CDDL HEADER START
9eb499828dd875d229531b50d05f016b8a1f1dd9vboxsync# The contents of this file are subject to the terms of the
9eb499828dd875d229531b50d05f016b8a1f1dd9vboxsync# Common Development and Distribution License, Version 1.0 only
9eb499828dd875d229531b50d05f016b8a1f1dd9vboxsync# (the "License"). You may not use this file except in compliance
cc4463d266cc5b433b63b2231570a9f77c126ab6vboxsync# with the License.
cc4463d266cc5b433b63b2231570a9f77c126ab6vboxsync# You can obtain a copy of the license at
cc4463d266cc5b433b63b2231570a9f77c126ab6vboxsync# trunk/opends/resource/legal-notices/OpenDS.LICENSE
9eb499828dd875d229531b50d05f016b8a1f1dd9vboxsync# See the License for the specific language governing permissions
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# and limitations under the License.
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# When distributing Covered Code, include this CDDL HEADER in each
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# file and include the License file at
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync# add the following below this CDDL HEADER, with the fields enclosed
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# by brackets "[]" replaced with your own identifying * information:
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# Portions Copyright [yyyy] [name of copyright owner]
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# CDDL HEADER END
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# Portions Copyright 2006 Sun Microsystems, Inc.
4bc1bbf45f30ff3ca38c2ad006836e490972c7ccvboxsync# Capture the current working directory so that we can change to it later.
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# Then capture the location of this script and the Directory Server instance
4bc1bbf45f30ff3ca38c2ad006836e490972c7ccvboxsync# root so that we can use them to create appropriate paths.
4bc1bbf45f30ff3ca38c2ad006836e490972c7ccvboxsynccd "${WORKING_DIR}"
da6747c2419b9cea8b5e2c576a30a5de999a8ab3vboxsync# See if JAVA_HOME is set. If not, then see if there is a java executable in
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# the path and try to figure it out.
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsyncif test -z "${JAVA_BIN}"
c7f55daa53d5798572d767a5f9075eead91ad490vboxsync if test -z "${JAVA_HOME}"
bffb24521128f5183aafbef6542e7dacf20b5132vboxsync if test -f "${INSTANCE_ROOT}/bin/set-java-home"
e1f397485a50a958c625b4d709c052aa2687a4fbvboxsync . "${INSTANCE_ROOT}/bin/set-java-home"
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync echo "Please set JAVA_HOME to the root of a Java 5.0 installation."
4a4856069da3a44c647c802b7df4f0c9ae1ea179vboxsync# Explicitly set the PATH, LD_LIBRARY_PATH, LD_PRELOAD, and other important
1deb4de12fed2ad1932401517862e6b5dc5466a3vboxsync# system environment variables for security and compatibility reasons.
4bc1bbf45f30ff3ca38c2ad006836e490972c7ccvboxsyncexport PATH LD_LIBRARY_PATH LD_LIBRARY_PATH_32 LD_LIBRARY_PATH_64 \
2e79d47d2d6374acf3e3c06f2bb803b149c960acvboxsync# Configure the appropriate CLASSPATH.
c7f55daa53d5798572d767a5f9075eead91ad490vboxsync# Specify the locations of important files that may be used when the server
4bc1bbf45f30ff3ca38c2ad006836e490972c7ccvboxsync# is starting.
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# Specify the script name so that it may be provided in command-line usage.
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsyncSCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=start-ds"
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# See if an "-N" or a "--nodetach" argument was provided as a command-line
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# argument. If it was, then don't use nohup to send to the background, and
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync# send all output to both the console and a lot file.
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync echo $$ > "${PID_FILE}"
6be66de4257f4f564e35f7b8ee57a282e3cf3e96vboxsync exec "${JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} \
7529922bd11d7d1c38fbdc7bad6aec83eb2ec0advboxsync --configClass org.opends.server.extensions.ConfigFileHandler \
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync nohup "${JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} \
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync --configClass org.opends.server.extensions.ConfigFileHandler \
a0a9f39e8864357c2e1e61106958411240f5bf6bvboxsync --configFile "${CONFIG_FILE}" "${@}" > "${LOG_FILE}" 2>&1 &
a0a9f39e8864357c2e1e61106958411240f5bf6bvboxsync echo $! > "${PID_FILE}"
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync "${JAVA_BIN}" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete \
939ffd583b0105c9cfab3570932faa41e0ccd563vboxsync --targetFile "${STARTING_FILE}" --logFile "${LOG_FILE}"