stop-ds revision 266c5071a91fda6a5159b08ea8d45261228d03d5
6aa2272cc4af77e605ba2c4a4781f8567408b7e3pquerna# CDDL HEADER START
ff2e7b35704e8610383152ebc823b94515d9fc2eniq# The contents of this file are subject to the terms of the
ff2e7b35704e8610383152ebc823b94515d9fc2eniq# Common Development and Distribution License, Version 1.0 only
ff2e7b35704e8610383152ebc823b94515d9fc2eniq# (the "License"). You may not use this file except in compliance
ff2e7b35704e8610383152ebc823b94515d9fc2eniq# with the License.
0a44bb1ff02dc8d3623e919c6d59f151bdd92ea0ianh# You can obtain a copy of the license at
52e3d2373288a4015d4152067c124e4dc9876f08trawick# See the License for the specific language governing permissions
6ecde05c829c9d0aa24b2b1c18b40c8739997571trawick# and limitations under the License.
6ecde05c829c9d0aa24b2b1c18b40c8739997571trawick# When distributing Covered Code, include this CDDL HEADER in each
17d53ea32c4968e47733f1c2c063ae07d280efd6jerenkrantz# file and include the License file at
17d53ea32c4968e47733f1c2c063ae07d280efd6jerenkrantz# trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
17d53ea32c4968e47733f1c2c063ae07d280efd6jerenkrantz# add the following below this CDDL HEADER, with the fields enclosed
2d5532b13110a8d85653da92e97795b09cc25cc2trawick# by brackets "[]" replaced with your own identifying * information:
b38565306421ff53e9f7499bc728d6df5cec294dpquerna# Portions Copyright [yyyy] [name of copyright owner]
b38565306421ff53e9f7499bc728d6df5cec294dpquerna# CDDL HEADER END
3aeb30211790fef38a8297f990b7ad3b2c46ece9colm# Portions Copyright 2006 Sun Microsystems, Inc.
3aeb30211790fef38a8297f990b7ad3b2c46ece9colm# This script may be used to request that the Directory Server shut down.
3aeb30211790fef38a8297f990b7ad3b2c46ece9colm# It operates in two different ways, depending on how it is invoked. If it
3aeb30211790fef38a8297f990b7ad3b2c46ece9colm# is invoked without any arguments and a local PID file is available, then it
3aeb30211790fef38a8297f990b7ad3b2c46ece9colm# will stop the server by sending a TERM signal to the process, and this
6eb3a057b5e4f046faba79104d7941552de755dacolm# script will wait until the server has stopped before exiting. If any
6eb3a057b5e4f046faba79104d7941552de755dacolm# arguments were provided or there is no local PID file, then it will attempt
2e02c854b4531480fe3f7ab353154c99c5bd97e8jorton# to stop the server using an LDAP request.
2e02c854b4531480fe3f7ab353154c99c5bd97e8jorton# See if JAVA_HOME is set. If not, then see if there is a java executable in
2e02c854b4531480fe3f7ab353154c99c5bd97e8jorton# the path and try to figure it out.
c07be90520f577cdffc0ee59a81e7f2be4ab24c6martinif test -z "${JAVA_BIN}"
2e02c854b4531480fe3f7ab353154c99c5bd97e8jorton if test -z "${JAVA_HOME}"
70706a4d1ead0d72a443eac1cc446a0f1a4de069colm echo "Please set JAVA_HOME to the root of a Java 5.0 installation."
2e02c854b4531480fe3f7ab353154c99c5bd97e8jorton# Explicitly set the PATH, LD_LIBRARY_PATH, LD_PRELOAD, and other important
2e02c854b4531480fe3f7ab353154c99c5bd97e8jorton# system environment variables for security and compatibility reasons.
a09378e32e823d5619f766394fcdde1cfa16c5dajimexport PATH LD_LIBRARY_PATH LD_LIBRARY_PATH_32 LD_LIBRARY_PATH_64 \
ce8e09ffeb8c696f7fc6c5dfa8814c52caaac59bcolm# Capture the current working directory so that we can change to it later.
ce8e09ffeb8c696f7fc6c5dfa8814c52caaac59bcolm# Then capture the location of this script and the Directory Server instance
ce8e09ffeb8c696f7fc6c5dfa8814c52caaac59bcolm# root so that we can use them to create appropriate paths.
6eb3a057b5e4f046faba79104d7941552de755dacolmcd "${WORKING_DIR}"
6aa2272cc4af77e605ba2c4a4781f8567408b7e3pquerna# Configure the appropriate CLASSPATH.
1febae173a82bc2a71c3c0ba4105cf674000791bjim# Specify the script name so that it may be provided in command-line usage.
2b409b0583ef844d6f85002160cbc6df95b9afa8jerenkrantz# See if any arguments were provided and if a local PID file exists. If there
2b409b0583ef844d6f85002160cbc6df95b9afa8jerenkrantz# were no arguments and there is a PID file, then try to stop the server with
454d060a0d7b13606978c536f632be71e311959djerenkrantz# a kill command.
454d060a0d7b13606978c536f632be71e311959djerenkrantzif test -z "${1}"
454d060a0d7b13606978c536f632be71e311959djerenkrantz if test -f "${INSTANCE_ROOT}/logs/server.pid"
4b0a0ae3fd77f8fc8fd2a693be33ffe4d99cb94ajerenkrantz "${JAVA_BIN}" -Xms8M -Xmx8M org.opends.server.tools.WaitForFileDelete \
4b0a0ae3fd77f8fc8fd2a693be33ffe4d99cb94ajerenkrantz --targetFile "${INSTANCE_ROOT}/logs/server.pid" \
f07ae092933846055c4ca046c5a65de83d79c9c6pquerna# If we've gotten here, then we should try to stop the server over LDAP.