#! /usr/bin/ksh93 # # # Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. # source /lib/svc/share/smf_include.sh typeset -r LDAPUSR=openldap typeset -r LDAPGRP=openldap typeset -r VARRUNDIR=/var/openldap/run typeset -r PIDFILE=${VARRUNDIR}/slapd.pid typeset -r CONF_FILE=/etc/openldap/slapd.conf typeset -r SLAPD="/usr/lib/slapd -u ${LDAPUSR} -g ${LDAPGRP} -f ${CONF_FILE}" [[ ! -f ${CONF_FILE} ]] && exit $SMF_EXIT_ERR_CONFIG case "$1" in start) if [[ ! -d ${VARRUNDIR} ]] ; then /usr/bin/mkdir -m 700 ${VARRUNDIR} || exit $SMF_EXIT_ERR_CONFIG /usr/bin/chown ${LDAPUSR}:${LDAPGRP} ${VARRUNDIR} else /bin/rm -f ${PIDFILE} fi exec ${SLAPD} 2>&1 ;; stop) # Use the actual contract, not ${PIDFILE} smf_kill_contract $2 TERM 1 30 ret=$? [ $ret -ne 0 ] && exit 1 exit $ret ;; *) print "Usage: $0 {start|stop}" exit 1 ;; esac # not reached