#!/usr/sbin/sh # # Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. # # # Start/Stop client LDAP service # . /lib/svc/share/smf_include.sh case "$1" in 'start') # Only import on first boot after install/upgrade. if is_self_assembly_boot; then /usr/sbin/nscfg import -q $SMF_FMRI err=$? if [ $err -eq 1 ] ; then echo "WARNING: $SMF_FMRI configuration import error." \ >& 2 exit $SMF_EXIT_ERR_CONFIG elif [ $err -eq 3 ] ; then echo "WARNING: $SMF_FMRI no configuration." >& 2 fi fi # Only export if allowed. if [[ -w /etc ]]; then /usr/sbin/nscfg export $SMF_FMRI err=$? if [ $err -eq 1 ] ; then echo "WARNING: $SMF_FMRI configuration export error." \ >& 2 exit $SMF_EXIT_ERR_CONFIG fi fi if [ ! -r /var/ldap/ldap_client_file ]; then echo "WARNING: /var/ldap/ldap_client_file is missing or not readable" >& 2 exit $SMF_EXIT_ERR_CONFIG fi exec /usr/lib/ldap/ldap_cachemgr ;; 'refresh') # When we can't write the configuration file, we want an error. /usr/sbin/nscfg export $SMF_FMRI if [ $? -eq 2 ] ; then exit $SMF_EXIT_OK fi /usr/bin/pkill -HUP ldap_cachemgr ;; 'stop') exec /usr/lib/ldap/ldap_cachemgr -K ;; 'unconfigure') # Permanently shutdown service svcadm disable $SMF_FMRI # Unroll any admin customization svccfg -s svc:/network/ldap/client delcust if [ $? -ne 0 ]; then echo "Failed to unroll administrative customizations for $SMF_FMRI" exit $SMF_EXIT_ERR_FATAL fi svcadm refresh svc:/network/ldap/client rm -rf /var/ldap/* ;; *) echo "Usage: $0 { start | refresh | stop | unconfigure }" exit 1 ;; esac