#
# $Id: start-ds 560 2013-05-22 07:36:34Z elkner $
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License"). You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at
# trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
# add the following below this CDDL HEADER, with the fields enclosed
# by brackets "[]" replaced with your own identifying information:
# Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright 2006-2009 Sun Microsystems, Inc.
# Portions Copyright 2011 ForgeRock AS
# Portions Copyright 2013 Jens Elkner
# Set environment variables
CHECK_VERSION='yes'
# would use -i, but -s is also just version info but is not a common switch
checkEnv 'set-full-environment-and-test-java'
typeset -a DJARGS=( )
if isVersionOrHelp "$@" ; then
INFO=1
else
if [[ ${ LC_ALL= LC_MESSAGES=C tty ; } == 'not a tty' ]]; then
# remove no detach arg and assume, it is started by SMF
done
else
done
# issue a warning, if the service is running and one tries to start it
# manually as well - let the app do the rest
STATE=''
[[ -n ${SMF_FMRI} ]] && \
print -u2 "WARNING: The service '${SMF_FMRI}' is not disabled!"
fi
fi
fi
fi
# Specify the locations of important files that may be used when the server
# is starting.
-Dorg.opends.server.InstallRoot="${INSTALL_ROOT}" \
-Dorg.opends.server.InstanceRoot="${INSTANCE_ROOT}" \
--configFile "${CONFIG_FILE}" "$@"
exit $?
fi
# We do not check for startability, since for non-Windows it just returns
# based on the passed arguments:
# 99 => 'start as detached'
# 100 => 'start as non-detached'
# 103 => 'start as detached quiet'
# 104 => 'start as non-detached quiet'
# what we already know by parsing the args above. If an arg or instance problem
# exists, exit 999 from checkEnv or checkInstance would prevent getting here.
# So doing a --checkStartability would not by us anything ...
touch "${STARTING_FILE}"
-Dorg.opends.server.InstallRoot="${INSTALL_ROOT}" \
-Dorg.opends.server.InstanceRoot="${INSTANCE_ROOT}" \
print $! > "${PID_FILE}"
# wait until server startup has finished: removes ${STARTING_FILE} when done
--targetFile "${STARTING_FILE}" \
"${DJARGS[@]}"
else
"${DJARGS[@]}"
fi
RC=$?
# 1 => 'internal error', '2' => 'timeout'
# now check, whether the server is still running
-Dorg.opends.server.InstallRoot="${INSTALL_ROOT}" \
-Dorg.opends.server.InstanceRoot="${INSTANCE_ROOT}" \
# 98 => 'already started', otherwise server doesn't run
(( $? == 98 )) && exit 0 || exit 1
fi
# non-detach
print $$ > "${PID_FILE}"
rm -f "${LOG_FILE}"
-Dorg.opends.server.InstallRoot="${INSTALL_ROOT}" \
-Dorg.opends.server.InstanceRoot="${INSTANCE_ROOT}" \
fi
print $$ > "${PID_FILE}"
rm -f "${LOG_FILE}"
-Dorg.opends.server.InstallRoot="${INSTALL_ROOT}" \
-Dorg.opends.server.InstanceRoot="${INSTANCE_ROOT}" \
--configFile "${CONFIG_FILE}" "${DJARGS[@]}"