#
# $Id: stop-ds 553 2013-04-13 17:41: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
# This script may be used to request that the Directory Server shut down.
# It operates in two different ways, depending on how it is invoked. If it
# is invoked without any arguments and a local PID file is available, then it
# will stop the server by sending a TERM signal to the process, and this
# script will wait until the server has stopped before exiting. If any
# arguments were provided or there is no local PID file, then it will attempt
# to stop the server using an LDAP request.
# We keep this values to reset the environment before calling start-ds.
# Set environment variables
if ! isVersionOrHelp "$@" ; then
integer RESTART=0
done
# If restart is requested, check whether the service is not disabled. If so,
# use svcadm to restart, otherwise fall through.
then
print -u2 "Restarting service '${SMF_FMRI}' ..."
RC=$?
exit ${RC}
fi
fi
fi
RC=$?
STOPPED=1
# Already stopped and nothing else to do.
STOPPED=0
# Already stopped and must start locally
STOPPED=0
# Stop using system call
# Restart using system call
# If != stop using protocol
exit ${RC}
fi
print -u2 'ERROR: Unable to find the server.pid file to determine' \
'the process ID of the OpenDJ process to terminate.'
exit 1
fi
kill $PID
if (( $? == 0 )) ; then
"${OPENDJ_JAVA_BIN}" \
fi
fi
# Delete the pid file if the server is stopped (this can occur if the process
# has been killed using kill -9).
# Now if the user wants to restart the server, try to restart it if the server
# is stopped.
# Set the original values that the user had on the environment in order
# to be sure that the start-ds script works with the proper arguments
# (in particular if the user specified not to overwrite the environment)
exit $?
fi
# The user does not want to start the server locally and it is already stopped.
# Just exit.
# If we've gotten here, then we should try to stop the server over LDAP.
-Dorg.opends.server.InstallRoot="${INSTALL_ROOT}" \
-Dorg.opends.server.InstanceRoot="${INSTANCE_ROOT}" \