diff options
Diffstat (limited to 'net/openldap21-server/files/slapd.sh')
-rw-r--r-- | net/openldap21-server/files/slapd.sh | 71 |
1 files changed, 42 insertions, 29 deletions
diff --git a/net/openldap21-server/files/slapd.sh b/net/openldap21-server/files/slapd.sh index e8f6ed6b018d..21bdf775a0b1 100644 --- a/net/openldap21-server/files/slapd.sh +++ b/net/openldap21-server/files/slapd.sh @@ -2,44 +2,57 @@ # # $FreeBSD$ -slapd_program=@@PREFIX@@/libexec/slapd +slapd_program=%%PREFIX%%/libexec/slapd -# Uncomment one of the following: -# -# IPv4 Only -#slapd_args='-u ldap -g ldap -h ldap://0.0.0.0' +slapd_pidfile=%%LDAP_RUN_DIR%%/slapd.pid + +slapd_enable="NO" + +slapd_args= + +# Add the following lines to /etc/rc.conf to enable slapd: # -# IPv6 and IPv4 -#slapd_ags='-u ldap -g ldap -h "ldap://[::] ldap://0.0.0.0"' +#slapd_enable="YES" +#slapd_args='-h "ldapi://%2fvar%2frun%2fopenldap%2fldapi/????x-mod=0777 ldap://0.0.0.0/"' # -# IPv6 Only -#slapd_args='-u ldap -g ldap -h ldap://[::]' +# 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) # -slapd_args="-u ldap -g ldap" - -pidfile=/var/run/ldap/slapd.pid -case "$1" in -start) - if [ -x $slapd ]; then - echo -n ' slapd' - eval ${slapd_program} ${slapd_args} +# 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 - fi - ;; -stop) - if [ -f $pidfile ]; then - kill `cat $pidfile` - echo -n ' slapd' - rm $pidfile - else - echo ' slapd: not running' - 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 ;; *) - echo "Usage: `basename $0` {start|stop}" >&2 - exit 64 ;; esac |