| | |
| | | |
| | | cd "${WORKING_DIR}" |
| | | |
| | | |
| | | # See if the environment variables are set. If not, then see if there is a java |
| | | # executable in the path and try to figure it out. |
| | | if test -z "${OPENDS_JAVA_BIN}" |
| | | then |
| | | if test -z "${OPENDS_JAVA_HOME}" |
| | | then |
| | | if test -f "${INSTANCE_ROOT}/lib/set-java-home" |
| | | then |
| | | . "${INSTANCE_ROOT}/lib/set-java-home" |
| | | OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java" |
| | | export OPENDS_JAVA_BIN |
| | | else |
| | | if test -z "${JAVA_BIN}" |
| | | then |
| | | if test -z "${JAVA_HOME}" |
| | | then |
| | | OPENDS_JAVA_BIN=`which java 2> /dev/null` |
| | | if test ${?} -eq 0 |
| | | then |
| | | export OPENDS_JAVA_BIN |
| | | else |
| | | echo "Please set OPENDS_JAVA_HOME to the root of a Java 5 (or later) installation." |
| | | exit 1 |
| | | fi |
| | | else |
| | | OPENDS_JAVA_BIN="${JAVA_HOME}/bin/java" |
| | | export OPENDS_JAVA_BIN |
| | | fi |
| | | else |
| | | OPENDS_JAVA_BIN="${JAVA_BIN}" |
| | | export OPENDS_JAVA_BIN |
| | | fi |
| | | fi |
| | | else |
| | | OPENDS_JAVA_BIN="${OPENDS_JAVA_HOME}/bin/java" |
| | | export OPENDS_JAVA_BIN |
| | | fi |
| | | fi |
| | | |
| | | |
| | | # Explicitly set the PATH, LD_LIBRARY_PATH, LD_PRELOAD, and other important |
| | | # system environment variables for security and compatibility reasons. |
| | | PATH=/bin:/usr/bin |
| | | LD_LIBRARY_PATH= |
| | | LD_LIBRARY_PATH_32= |
| | | LD_LIBRARY_PATH_64= |
| | | LD_PRELOAD= |
| | | LD_PRELOAD_32= |
| | | LD_PRELOAD_64= |
| | | export PATH LD_LIBRARY_PATH LD_LIBRARY_PATH_32 LD_LIBRARY_PATH_64 \ |
| | | LD_PRELOAD LD_PRELOAD_32 LD_PRELOAD_34 |
| | | |
| | | |
| | | # Configure the appropriate CLASSPATH. |
| | | CLASSPATH=${INSTANCE_ROOT}/classes |
| | | for JAR in ${INSTANCE_ROOT}/lib/*.jar |
| | | do |
| | | CLASSPATH=${CLASSPATH}:${JAR} |
| | | done |
| | | export CLASSPATH |
| | | |
| | | |
| | | # Specify the locations of important files that may be used when the server |
| | | # is starting. |
| | | CONFIG_FILE=${INSTANCE_ROOT}/config/config.ldif |
| | |
| | | |
| | | |
| | | # Specify the script name so that it may be provided in command-line usage. |
| | | SCRIPT_NAME_ARG="-Dorg.opends.server.scriptName=start-ds" |
| | | export SCRIPT_NAME_ARG |
| | | SCRIPT_NAME="start-ds" |
| | | export SCRIPT_NAME |
| | | |
| | | # Test that the provided JDK is 1.5 compatible. |
| | | if test -z "${JAVA_ARGS}" |
| | | # Set environment variables |
| | | SCRIPT_UTIL_CMD=set-full-environment-and-test-java |
| | | export SCRIPT_UTIL_CMD |
| | | . "${INSTANCE_ROOT}/lib/_script-util.sh" |
| | | RETURN_CODE=$? |
| | | if test ${RETURN_CODE} -ne 0 |
| | | then |
| | | "${OPENDS_JAVA_BIN}" org.opends.server.tools.InstallDS -t 2> /dev/null |
| | | if test ${?} -ne 0 |
| | | then |
| | | echo "ERROR: The detected Java version could not be used. Please ensure" |
| | | echo " that OPENDS_JAVA_HOME is set to the root of a valid Java 5.0 or" |
| | | echo " higher installation." |
| | | exit 1 |
| | | fi |
| | | else |
| | | "${OPENDS_JAVA_BIN}" ${JAVA_ARGS} org.opends.server.tools.InstallDS -t 2> /dev/null |
| | | if test ${?} -ne 0 |
| | | then |
| | | echo "ERROR: The detected Java version could not be used with the" |
| | | echo " set of arguments. Please ensure that OPENDS_JAVA_HOME is" |
| | | echo " set to the root of a valid Java 5.0 or higher installation, and" |
| | | echo " make sure that JAVA_ARGS contains a valid set of arguments" |
| | | echo " for that JVM." |
| | | exit 1 |
| | | fi |
| | | exit ${RETURN_CODE} |
| | | fi |
| | | |
| | | |
| | | # See if the provided set of arguments were sufficient for us to be able to |
| | | # start the server or perform the requested operation. An exit code of 99 |
| | | # means that it should be possible to start the server. An exit code of 98 |
| | |
| | | # run detach |
| | | # |
| | | touch "${STARTING_FILE}" |
| | | nohup "${OPENDS_JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} \ |
| | | nohup "${OPENDS_JAVA_BIN}" ${OPENDS_JAVA_ARGS} ${SCRIPT_NAME_ARG} \ |
| | | org.opends.server.core.DirectoryServer \ |
| | | --configClass org.opends.server.extensions.ConfigFileHandler \ |
| | | --configFile "${CONFIG_FILE}" "${@}" > "${LOG_FILE}" 2>&1 & |
| | |
| | | # |
| | | echo $$ > "${PID_FILE}" |
| | | rm -f "${LOG_FILE}" |
| | | exec "${OPENDS_JAVA_BIN}" ${JAVA_ARGS} ${SCRIPT_NAME_ARG} \ |
| | | exec "${OPENDS_JAVA_BIN}" ${OPENDS_JAVA_ARGS} ${SCRIPT_NAME_ARG} \ |
| | | org.opends.server.core.DirectoryServer \ |
| | | --configClass org.opends.server.extensions.ConfigFileHandler \ |
| | | --configFile "${CONFIG_FILE}" "${@}" |