Mon, 28 Jan 2013 17:37:18 +0100
Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.
1 #!@l_prefix@/bin/openpkg rc
2 ##
3 ## rc.openldap -- Run-Commands
4 ##
6 %config
7 openldap_enable="$openpkg_rc_def"
8 openldap_flags=""
9 openldap_url="ldap://127.0.0.1:389/"
10 openldap_log_prolog="true"
11 openldap_log_epilog="true"
12 openldap_log_numfiles="10"
13 openldap_log_minsize="1M"
14 openldap_log_complevel="9"
16 %common
17 openldap_slapd_cfgfile="@l_prefix@/etc/openldap/slapd.conf"
18 openldap_slapd_pidfile="@l_prefix@/var/openldap/run/slapd.pid"
19 openldap_slapd_signal () {
20 [ -f $openldap_slapd_pidfile ] && kill -$1 `cat $openldap_slapd_pidfile`
21 }
23 %status -u @l_susr@ -o
24 openldap_usable="unknown"
25 openldap_active="no"
26 rcService openldap enable yes && \
27 openldap_slapd_signal 0 && openldap_active="yes"
28 echo "openldap_enable=\"$openldap_enable\""
29 echo "openldap_usable=\"$openldap_usable\""
30 echo "openldap_active=\"$openldap_active\""
32 %start -p 300 -u @l_susr@
33 rcService openldap enable yes || exit 0
34 openldap_slapd_signal 0
35 if [ $? -ne 0 ]; then
36 flags="$openldap_flags"
37 echo $flags | grep -- -h >/dev/null
38 if [ $? -ne 0 -a ".$openldap_url" != . ]; then
39 flags="$flags -h \"$openldap_url\""
40 fi
41 eval @l_prefix@/libexec/openldap/slapd $flags || exit $?
42 fi
44 %stop -p 700 -u @l_susr@
45 rcService openldap enable yes || exit 0
46 rcService openldap active no && exit 0
47 openldap_slapd_signal INT
48 sleep 2
50 %restart -u @l_susr@
51 rcService openldap enable yes || exit 0
52 rcService openldap active no && exit 0
53 rc openldap stop start
55 %daily -u @l_susr@
56 rcService openldap enable yes || exit 0
57 shtool rotate -f \
58 -n ${openldap_log_numfiles} -s ${openldap_log_minsize} -d \
59 -z ${openldap_log_complevel} -m 644 -o @l_susr@ -g @l_mgrp@ \
60 -P "${openldap_log_prolog}" \
61 -E "${openldap_log_epilog}; rc openldap restart" \
62 @l_prefix@/var/openldap/openldap.log