summaryrefslogtreecommitdiff
path: root/net/openldap23-server/files/slapd.sh
blob: 21bdf775a0b1636f62de3eeb72143f761e616e53 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/sh
#
# $FreeBSD$

slapd_program=%%PREFIX%%/libexec/slapd

slapd_pidfile=%%LDAP_RUN_DIR%%/slapd.pid

slapd_enable="NO"

slapd_args=

# Add the following lines to /etc/rc.conf to enable slapd:
#
#slapd_enable="YES"
#slapd_args='-h "ldapi://%2fvar%2frun%2fopenldap%2fldapi/????x-mod=0777 ldap://0.0.0.0/"'
#
# See sldap(8) for details
#
# Create a user 'ldap' and add '-u ldap -g ldap' to slapd_args
# if you want to run slapd as a non-privileged user (recommended)
#

# Suck in the configuration variables.
if [ -r /etc/defaults/rc.conf ]; then
    . /etc/defaults/rc.conf
    source_rc_confs
elif [ -r /etc/rc.conf ]; then
    . /etc/rc.conf
fi

case "$slapd_enable" in
[Yy][Ee][Ss])
    case "$1" in
    start)
        if [ -x ${slapd_program} ]; then
            echo -n ' slapd'
            eval ${slapd_program} ${slapd_args}
        fi
        ;;
    stop)
        if [ -f $slapd_pidfile ]; then
            kill `cat $slapd_pidfile`
            echo -n ' slapd'
        else
            echo ' slapd: not running'
        fi
        ;;
    *)
        echo "Usage: `basename $0` {start|stop}" >&2
        exit 64
        ;;
    esac
    ;;
*)
    ;;
esac

exit 0