474N/A#! /usr/bin/ksh93
474N/A
474N/A#
474N/A# CDDL HEADER START
474N/A#
474N/A# The contents of this file are subject to the terms of the
474N/A# Common Development and Distribution License (the "License").
474N/A# You may not use this file except in compliance with the License.
474N/A#
474N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
474N/A# or http://www.opensolaris.org/os/licensing.
474N/A# See the License for the specific language governing permissions
474N/A# and limitations under the License.
474N/A#
474N/A# When distributing Covered Code, include this CDDL HEADER in each
474N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
474N/A# If applicable, add the following below this CDDL HEADER, with the
474N/A# fields enclosed by brackets "[]" replaced with your own identifying
474N/A# information: Portions Copyright [yyyy] [name of copyright owner]
474N/A#
474N/A# CDDL HEADER END
474N/A#
474N/A
4382N/A# Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
474N/A#
474N/Asource /lib/svc/share/smf_include.sh
474N/A
474N/Atypeset -r LDAPUSR=openldap
474N/Atypeset -r LDAPGRP=openldap
4382N/Atypeset -r VARRUNDIR=/var/openldap/run
474N/Atypeset -r PIDFILE=${VARRUNDIR}/slapd.pid
474N/Atypeset -r CONF_FILE=/etc/openldap/slapd.conf
474N/Atypeset -r SLAPD="/usr/lib/slapd -u ${LDAPUSR} -g ${LDAPGRP} -f ${CONF_FILE}"
474N/A
474N/A[[ ! -f ${CONF_FILE} ]] && exit $SMF_EXIT_ERR_CONFIG
474N/A
474N/A
474N/Acase "$1" in
474N/Astart)
474N/A if [[ ! -d ${VARRUNDIR} ]] ; then
4382N/A /usr/bin/mkdir -m 700 ${VARRUNDIR} || exit $SMF_EXIT_ERR_CONFIG
474N/A /usr/bin/chown ${LDAPUSR}:${LDAPGRP} ${VARRUNDIR}
474N/A else
474N/A /bin/rm -f ${PIDFILE}
474N/A fi
474N/A
474N/A exec ${SLAPD} 2>&1
474N/A ;;
474N/Astop)
474N/A # Use the actual contract, not ${PIDFILE}
474N/A smf_kill_contract $2 TERM 1 30
474N/A ret=$?
474N/A [ $ret -ne 0 ] && exit 1
474N/A exit $ret
474N/A ;;
474N/A*)
474N/A print "Usage: $0 {start|stop}"
474N/A exit 1
474N/A ;;
474N/Aesac
474N/A
474N/A# not reached