wok view openldap/stuff/etc/init.d/openldap @ rev 3716

Fix: libftdi commit
author Matthew Sheets <rcx@zoominternet.net>
date Tue Jul 21 11:55:17 2009 +0000 (2009-07-21)
parents 8a251dbc2bed
children a44a640b886e
line source
1 #!/bin/sh
2 # /etc/init.d/openldap : Start, stop and restart LDAP server on SliTaz, at
3 # boot time or with the command line.
4 #
5 # To start LDAP server at boot time, just put openldap in the $RUN_DAEMONS
6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf
7 #
8 . /etc/init.d/rc.functions
9 . /etc/daemons.conf
11 NAME=Openldap
12 DESC="LDAP server"
13 DAEMON=/usr/libexec/slapd
14 OPTIONS=$LDAP_OPTIONS
15 PIDFILE=/var/run/slapd.pid
17 case "$1" in
18 start)
19 if active_pidfile $PIDFILE slapd ; then
20 echo "$NAME already running."
21 exit 1
22 fi
23 if [ ! -f /var/openldap-data/__db.001 ]; then
24 echo -n "Starting $DESC: $NAME... "
25 $DAEMON $OPTIONS && sleep 2
26 status
27 for i in /etc/ldap.d/* ; do
28 [ -x $i ] || continue
29 echo -n "Running $i..."
30 $i
31 status
32 done
33 else
34 echo -n "Starting $DESC: $NAME... "
35 $DAEMON $OPTIONS && sleep 2
36 status
37 fi
38 ;;
39 stop)
40 if ! active_pidfile $PIDFILE slapd ; then
41 echo "$NAME is not running."
42 exit 1
43 fi
44 echo -n "Stopping $DESC: $NAME... "
45 kill `cat $PIDFILE`
46 status
47 ;;
48 restart)
49 if ! active_pidfile $PIDFILE slapd ; then
50 echo "$NAME is not running."
51 exit 1
52 fi
53 echo -n "Restarting $DESC: $NAME... "
54 kill `cat $PIDFILE`
55 sleep 2
56 $DAEMON $OPTIONS && sleep 2
57 status
58 ;;
59 *)
60 echo ""
61 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
62 echo ""
63 exit 1
64 ;;
65 esac
67 exit 0