michael@174: #!@l_prefix@/bin/openpkg rc michael@174: ## michael@174: ## rc.openldap -- Run-Commands michael@174: ## michael@174: michael@174: %config michael@174: openldap_enable="$openpkg_rc_def" michael@174: openldap_flags="" michael@174: openldap_url="ldap://127.0.0.1:389/" michael@174: openldap_log_prolog="true" michael@174: openldap_log_epilog="true" michael@174: openldap_log_numfiles="10" michael@174: openldap_log_minsize="1M" michael@174: openldap_log_complevel="9" michael@174: michael@174: %common michael@174: openldap_slapd_cfgfile="@l_prefix@/etc/openldap/slapd.conf" michael@174: openldap_slapd_pidfile="@l_prefix@/var/openldap/run/slapd.pid" michael@174: openldap_slapd_signal () { michael@174: [ -f $openldap_slapd_pidfile ] && kill -$1 `cat $openldap_slapd_pidfile` michael@174: } michael@174: michael@174: %status -u @l_susr@ -o michael@174: openldap_usable="unknown" michael@174: openldap_active="no" michael@174: rcService openldap enable yes && \ michael@174: openldap_slapd_signal 0 && openldap_active="yes" michael@174: echo "openldap_enable=\"$openldap_enable\"" michael@174: echo "openldap_usable=\"$openldap_usable\"" michael@174: echo "openldap_active=\"$openldap_active\"" michael@174: michael@174: %start -p 300 -u @l_susr@ michael@174: rcService openldap enable yes || exit 0 michael@174: openldap_slapd_signal 0 michael@174: if [ $? -ne 0 ]; then michael@174: flags="$openldap_flags" michael@174: echo $flags | grep -- -h >/dev/null michael@174: if [ $? -ne 0 -a ".$openldap_url" != . ]; then michael@174: flags="$flags -h \"$openldap_url\"" michael@174: fi michael@174: eval @l_prefix@/libexec/openldap/slapd $flags || exit $? michael@174: fi michael@174: michael@174: %stop -p 700 -u @l_susr@ michael@174: rcService openldap enable yes || exit 0 michael@174: rcService openldap active no && exit 0 michael@174: openldap_slapd_signal INT michael@174: sleep 2 michael@174: michael@174: %restart -u @l_susr@ michael@174: rcService openldap enable yes || exit 0 michael@174: rcService openldap active no && exit 0 michael@174: rc openldap stop start michael@174: michael@174: %daily -u @l_susr@ michael@174: rcService openldap enable yes || exit 0 michael@174: shtool rotate -f \ michael@174: -n ${openldap_log_numfiles} -s ${openldap_log_minsize} -d \ michael@174: -z ${openldap_log_complevel} -m 644 -o @l_susr@ -g @l_mgrp@ \ michael@174: -P "${openldap_log_prolog}" \ michael@174: -E "${openldap_log_epilog}; rc openldap restart" \ michael@174: @l_prefix@/var/openldap/openldap.log michael@174: