start-ds revision 486
75c0816e8295e180f4bc7f10db3d0d880383bc1cMark Andrews# CDDL HEADER START
4a14ce5ba00ab7bc55c99ffdcf59c7a4ab902721Automatic Updater# The contents of this file are subject to the terms of the
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Common Development and Distribution License, Version 1.0 only
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# (the "License"). You may not use this file except in compliance
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# with the License.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# You can obtain a copy of the license at
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# trunk/opends/resource/legal-notices/OpenDS.LICENSE
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# See the License for the specific language governing permissions
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# and limitations under the License.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# When distributing Covered Code, include this CDDL HEADER in each
f7b2875691497b292eacb60609be23a813d14e63Automatic Updater# file and include the License file at
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# add the following below this CDDL HEADER, with the fields enclosed
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# by brackets "[]" replaced with your own identifying * information:
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Portions Copyright [yyyy] [name of copyright owner]
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# CDDL HEADER END
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Portions Copyright 2006 Sun Microsystems, Inc.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# See if JAVA_HOME is set. If not, then see if there is a java executable in
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# the path and try to figure it out.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinif test -z "${JAVA_BIN}"
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein if test -z "${JAVA_HOME}"
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein echo "Please set JAVA_HOME to the root of a Java 5.0 installation."
dcfda24abf565c442d058cbf81b2180d847a1b3eAutomatic Updater# Explicitly set the PATH, LD_LIBRARY_PATH, LD_PRELOAD, and other important
dcfda24abf565c442d058cbf81b2180d847a1b3eAutomatic Updater# system environment variables for security and compatibility reasons.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeinexport PATH LD_LIBRARY_PATH LD_LIBRARY_PATH_32 LD_LIBRARY_PATH_64 \
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# Capture the current working directory so that we can change to it later.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews# Then capture the location of this script and the Directory Server instance
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# root so that we can use them to create appropriate paths.
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austeincd "${WORKING_DIR}"
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# Configure the appropriate CLASSPATH.
ac93437301f55ed69bf85883a497a75598c628f9Automatic Updater# Specify the locations of important files that may be used when the server
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric LuceSTARTING_FILE=${INSTANCE_ROOT}/logs/server.starting
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# See if "-nodetach" was specified as the first command-line argument. If it
f293a69bcd1c1dd7bdac8f4102fc2398b9e475c8Eric Luce# was, then don't use nohup to send to the background, and send all output to
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein# both the console and a log file.
dcfda24abf565c442d058cbf81b2180d847a1b3eAutomatic Updater echo $$ > "${PID_FILE}"
60e5e10f8d2e2b0c41e8abad38cacd867caa6ab2Rob Austein --configClass org.opends.server.extensions.ConfigFileHandler \
ac93437301f55ed69bf85883a497a75598c628f9Automatic Updater --configClass org.opends.server.extensions.ConfigFileHandler \
ac93437301f55ed69bf85883a497a75598c628f9Automatic Updater --configFile "${CONFIG_FILE}" "${@}" > "${LOG_FILE}" 2>&1 &
ac93437301f55ed69bf85883a497a75598c628f9Automatic Updater echo $! > "${PID_FILE}"
ac93437301f55ed69bf85883a497a75598c628f9Automatic Updater "${JAVA_BIN}" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete \
ac93437301f55ed69bf85883a497a75598c628f9Automatic Updater --targetFile "${STARTING_FILE}" --logFile "${LOG_FILE}"