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