wok annotate openldap/stuff/etc/init.d/openldap @ rev 21754
Up firefox-official (67.0.3), tinyproxy (1.10.0)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Jun 19 17:26:14 2019 +0200 (2019-06-19) |
parents | 97a1415c2ffa |
children |
rev | line source |
---|---|
pascal@1155 | 1 #!/bin/sh |
al@19159 | 2 # /etc/init.d/openldap : Start, stop and restart LDAP server on SliTaz, at |
pascal@1155 | 3 # boot time or with the command line. |
pascal@1155 | 4 # |
pascal@1155 | 5 # To start LDAP server at boot time, just put openldap in the $RUN_DAEMONS |
pascal@1155 | 6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf |
pascal@1155 | 7 # |
pascal@1155 | 8 . /etc/init.d/rc.functions |
pascal@1155 | 9 . /etc/daemons.conf |
pascal@1155 | 10 |
pascal@1155 | 11 NAME=Openldap |
al@19159 | 12 DESC="$(_ '%s server' LDAP)" |
erjo@5675 | 13 DAEMON=/usr/lib/openldap/slapd |
pascal@1155 | 14 OPTIONS=$LDAP_OPTIONS |
pascal@13531 | 15 PIDFILE=/var/lib/openldap/run/slapd.pid |
pascal@1155 | 16 |
pascal@1155 | 17 case "$1" in |
pascal@1155 | 18 start) |
pascal@2401 | 19 if active_pidfile $PIDFILE slapd ; then |
al@19159 | 20 _ '%s is already running.' $NAME |
pascal@1155 | 21 exit 1 |
pascal@1155 | 22 fi |
al@19159 | 23 action 'Starting %s: %s...' "$DESC" $NAME |
pascal@4957 | 24 $DAEMON $OPTIONS && sleep 2 |
pascal@4957 | 25 status |
pascal@4957 | 26 for i in /etc/ldap.d/* ; do |
al@19159 | 27 [ -x $i ] || continue |
al@19159 | 28 action 'Running %s...' $i |
al@19159 | 29 $i |
al@19159 | 30 status |
pascal@4957 | 31 done |
pascal@1155 | 32 ;; |
pascal@1155 | 33 stop) |
pascal@2401 | 34 if ! active_pidfile $PIDFILE slapd ; then |
al@19159 | 35 _ '%s is not running.' $NAME |
pascal@1155 | 36 exit 1 |
pascal@1155 | 37 fi |
al@19159 | 38 action 'Stopping %s: %s...' "$DESC" $NAME |
al@19159 | 39 kill $(cat $PIDFILE) |
pascal@1155 | 40 status |
pascal@1155 | 41 ;; |
pascal@1155 | 42 restart) |
pascal@2401 | 43 if ! active_pidfile $PIDFILE slapd ; then |
al@19159 | 44 _ '%s is not running.' $NAME |
pascal@1155 | 45 exit 1 |
pascal@1155 | 46 fi |
al@19159 | 47 action 'Restarting %s: %s...' "$DESC" $NAME |
al@19159 | 48 kill $(cat $PIDFILE) |
pascal@1155 | 49 sleep 2 |
pascal@1960 | 50 $DAEMON $OPTIONS && sleep 2 |
pascal@1155 | 51 status |
pascal@1155 | 52 ;; |
pascal@1155 | 53 *) |
al@19159 | 54 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]" |
al@19159 | 55 newline |
pascal@1155 | 56 exit 1 |
pascal@1155 | 57 ;; |
pascal@1155 | 58 esac |
pascal@1155 | 59 |
pascal@1155 | 60 exit 0 |