stop-ds revision 6983
486N/A# The contents of this file are subject to the terms of the 486N/A# Common Development and Distribution License, Version 1.0 only 486N/A# (the "License"). You may not use this file except in compliance 486N/A# See the License for the specific language governing permissions 486N/A# and limitations under the License. 486N/A# When distributing Covered Code, include this CDDL HEADER in each 6983N/A# If applicable, add the following below this CDDL HEADER, with the 6983N/A# fields enclosed by brackets "[]" replaced with your own identifying 486N/A# Portions Copyright [yyyy] [name of copyright owner] 4103N/A# Copyright 2006-2009 Sun Microsystems, Inc. 5306N/A# Portions Copyright 2011 ForgeRock AS 486N/A# This script may be used to request that the Directory Server shut down. 486N/A# It operates in two different ways, depending on how it is invoked. If it 486N/A# is invoked without any arguments and a local PID file is available, then it 486N/A# will stop the server by sending a TERM signal to the process, and this 486N/A# script will wait until the server has stopped before exiting. If any 486N/A# arguments were provided or there is no local PID file, then it will attempt 486N/A# to stop the server using an LDAP request. 619N/A# Capture the current working directory so that we can change to it later. 619N/A# Then capture the location of this script and the Directory Server instance 619N/A# root so that we can use them to create appropriate paths. 3196N/A# We keep this values to reset the environment before calling start-ds. 2976N/A# Specify the script name so that we can use the specified java properties. 5306N/A# Check --exec. If not present, start OpenDJ from SMF 3972N/A elif [
"$1" !=
"-V" -a
"$1" !=
"--version" -a
"$1" !=
"-?" -a \
3972N/A "$1" !=
"-H" -a
"$1" !=
"--help" ]
3972N/A#These options are not stopping the server, but checking version and help 4103N/A if [
"$1" =
"-R" -o
"$1" =
"--restart" ]
961N/A# Already stopped and nothing else to do. 961N/A # Already stopped and must start locally. 961N/A # Stop using system call 961N/A # Restart using system call 5612N/A echo " ID of the OpenDJ process to terminate." 961N/A# Delete the pid file if the server is stopped (this can occur if the process 961N/A# has been killed using kill -9). 961N/A# Now if the user wants to restart the server, try to restart it if the server 3196N/A# Set the original values that the user had on the environment in order to be 3196N/A# sure that the start-ds script works with the proper arguments (in particular 3196N/A# if the user specified not to overwrite the environment). 961N/A# The user does not want to start the server locally and it is already stopped. 486N/A# If we've gotten here, then we should try to stop the server over LDAP.