« Squid GuardSoftware RAID »

SLAPD Service Control Script

07/26/04

Permalink 09:37:32 am, by admin Email , 211 words   English (US)
Categories: Linux, Service Control Scripts

SLAPD Service Control Script

#!/bin/sh
#
# chkconfig: - 91 35
# description: Starts and stops the OpenLDAP slapd daemon
#
# pidfile: /usr/local/openldap-2.2.4/var/run/slapd.pid
# config:  /usr/local/openldap-2.2.4/etc/openldap/slapd.conf

INSTALL_BASE=/usr/local/openldap-2.2.4
BDB_BASE=/usr/local/BerkeleyDB.4.2

# Source function library.
if [ -f /etc/init.d/functions ] ; then
  . /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
  . /etc/rc.d/init.d/functions
else
  exit 0
fi

# Avoid using root's TMPDIR
unset TMPDIR

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

# Check that smb.conf exists.
[ -f $INSTALL_BASE/etc/openldap/slapd.conf ] || exit 0

RETVAL=0


start() {
        action "Recovering slapd database: " $BDB_BASE/bin/db_recover -h $INSTALL_BASE/var/openldap-data
        action "Recovering slapd database (US): " $BDB_BASE/bin/db_recover -h $INSTALL_BASE/var/openldap-us-data
        echo -n $"Starting slapd: "
        daemon $INSTALL_BASE/libexec/slapd
        RETVAL=$?
        echo
        return $RETVAL
}

stop() {
        KIND="SMB"
        echo -n $"Shutting down slapd: "
        action "" kill -INT `cat $INSTALL_BASE/var/run/slapd.pid`
        RETVAL=$?
        echo
        return $RETVAL
}

restart() {
        stop
        start
}

reload() {
        echo -n $"Reloading slapd.conf file: "
        killproc slapd -HUP
        RETVAL=$?
        echo
        return $RETVAL
}

rhstatus() {
        status slapd
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  reload)
        reload
        ;;
  status)
        rhstatus
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart|status}"
        exit 1
esac

exit $?

July 2010
Sun Mon Tue Wed Thu Fri Sat
 << <   > >>
        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

Reliable Penguin offers Linux Server Migrations, Systems Administration & Programming. Visit our main website at:

http://www.reliablepenguin.com

Search

Bookmark and Share

XML Feeds

blogging tool