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

Up moc (2.5.0)
author Paul Issott <paul@slitaz.org>
date Thu Sep 04 23:36:22 2014 +0100 (2014-09-04)
parents 83b623382b77
children 7f188676b59c
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/lib/openldap/slapd
14 OPTIONS=$LDAP_OPTIONS
15 PIDFILE=/var/lib/openldap/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 echo -n "Starting $DESC: $NAME... "
24 $DAEMON $OPTIONS && sleep 2
25 status
26 for i in /etc/ldap.d/* ; do
27 [ -x $i ] || continue
28 echo -n "Running $i..."
29 $i
30 status
31 done
32 ;;
33 stop)
34 if ! active_pidfile $PIDFILE slapd ; then
35 echo "$NAME is not running."
36 exit 1
37 fi
38 echo -n "Stopping $DESC: $NAME... "
39 kill `cat $PIDFILE`
40 status
41 ;;
42 restart)
43 if ! active_pidfile $PIDFILE slapd ; then
44 echo "$NAME is not running."
45 exit 1
46 fi
47 echo -n "Restarting $DESC: $NAME... "
48 kill `cat $PIDFILE`
49 sleep 2
50 $DAEMON $OPTIONS && sleep 2
51 status
52 ;;
53 *)
54 echo ""
55 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
56 echo ""
57 exit 1
58 ;;
59 esac
61 exit 0