Radix cross Linux

The main Radix cross Linux repository contains the build scripts of packages, which have the most complete and common functionality for desktop machines

452 Commits   2 Branches   1 Tag
     5         kx #!/bin/sh
     5         kx # Start/stop/restart the OpenLDAP server (slapd).
     5         kx 
     5         kx # Source default settings:
     5         kx if [ -r /etc/default/slapd ]; then
     5         kx   . /etc/default/slapd
     5         kx fi
     5         kx 
     5         kx # If needed, create run directory:
     5         kx if [ ! -d /var/run/openldap ]; then
     5         kx   mkdir -p /var/run/openldap
     5         kx   chown ldap:ldap /var/run/openldap
     5         kx fi
     5         kx 
     5         kx slapd_start() {
     5         kx   if [ -e /var/run/openldap/slapd.pid ]; then
     5         kx     echo "ERROR: Not starting OpenLDAP server because /var/run/openldap/slapd.pid exists."
     5         kx   elif [ -x /usr/sbin/slapd ]; then
     5         kx     echo "Starting OpenLDAP server:  /usr/sbin/slapd -u ldap -h "$SLAPD_URLS" $SLAPD_OPTIONS"
     5         kx     /usr/sbin/slapd -u ldap -h "$SLAPD_URLS" $SLAPD_OPTIONS 1> /dev/null 2> /dev/null
     5         kx   fi
     5         kx }
     5         kx 
     5         kx slapd_stop() {
     5         kx   if [ -e /var/run/openldap/slapd.pid ]; then
     5         kx     echo "Stopping OpenLDAP server."
     5         kx     kill -INT $(cat /var/run/openldap/slapd.pid)
     5         kx   else
     5         kx     echo "ERROR: Not stopping OpenLDAP server because /var/run/openldap/slapd.pid does not exist."
     5         kx   fi
     5         kx   rm -f /var/run/openldap/slapd.pid
     5         kx }
     5         kx 
     5         kx slapd_restart() {
     5         kx   slapd_stop
     5         kx   sleep 1
     5         kx   slapd_start
     5         kx }
     5         kx 
     5         kx slapd_status() {
     5         kx   if [ -e /var/run/openldap/slapd.pid ]; then
     5         kx     if ps axc | grep slapd >/dev/null 2>&1; then
     5         kx       echo "OpenLDAP is running."
     5         kx       return 0
     5         kx     fi
     5         kx     echo "OpenLDAP PID file exists but the service is down."
     5         kx     return 1
     5         kx   else
     5         kx     echo "OpenLDAP is stopped."
     5         kx     return 0
     5         kx   fi
     5         kx }
     5         kx 
     5         kx case "$1" in
     5         kx   'start')
     5         kx     slapd_start
     5         kx     ;;
     5         kx   'stop')
     5         kx     slapd_stop
     5         kx     ;;
     5         kx   'restart')
     5         kx     slapd_restart
     5         kx     ;;
     5         kx   'status')
     5         kx     slapd_status
     5         kx     ;;
     5         kx   *)
     5         kx     echo "usage $0 start|stop|restart"
     5         kx esac