6331N/A# $Id: stop-ds 553 2013-04-13 17:41:34Z elkner $ 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# You can obtain a copy of the license at 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 486N/A# file and include the License file at 486N/A# add the following below this CDDL HEADER, with the fields enclosed 873N/A# by brackets "[]" replaced with your own identifying information: 486N/A# Portions Copyright [yyyy] [name of copyright owner] 4103N/A# Copyright 2006-2009 Sun Microsystems, Inc. 5306N/A# Portions Copyright 2011 ForgeRock AS 6331N/A# Portions Copyright 2013 Jens Elkner 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. 3196N/A# We keep this values to reset the environment before calling start-ds. 6331N/A # If restart is requested, check whether the service is not disabled. If so, 6331N/A # use svcadm to restart, otherwise fall through. 6331N/A print -
u2 "Restarting service '${SMF_FMRI}' ..." 6331N/A (( ${RC} != 0 )) &&
print -
u2 'Done.' ||
print -
u2 'Failed.' 6331N/A # Already stopped and nothing else to do. 6331N/A # Already stopped and must start locally 6331N/A # Restart using system call 6331N/A # If != stop using protocol 6331N/A 'the process 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 6331N/A # Set the original values that the user had on the environment in order 6331N/A # to be sure that the start-ds script works with the proper arguments 6331N/A # (in particular 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.