[Date Prev][Date Next] [Chronological] [Thread] [Top]

[openldap2.1.12] script of automatic restarting for linux



Hi,
Currently, I have a script to stop/start automatically openldap (cf. slapd)
I put it in the directory /etc/init.d and use the command checkconfig

This script is interesting when openldap works correctly but sometimes it's not enough to process all cases
mainly to stop it correctly when openldap is completely "out"

So do you have a complete script of automatic restarting ... ?

Thanks a lot
Helene

Working Environment :
Linux redhat 7.3
Berkley4.1.24
openldap2.1.12

#!/bin/sh
#
# chkconfig: 2345 96 04
# description: script to start/stop openldap server
# processname: slapd

case "$1" in
'start')
   /opt/openldap-clients-servers/libexec/slapd -h ldap://192.9.200.167:389
   echo "OpenLdap Started"
   ;;

'stop')
   if [ -f $OPENLDAP_PATH/var/slapd.pid ]
   then
	   pid=`cat /opt/openldap-clients-servers/var/slapd.pid`
	   res=`ps -efl | grep slapd | grep $pid`
	   if [ "$res" != "" ]
	   then
	   	kill -INT `cat /opt/openldap-clients-servers/var/slapd.pid`
	   	echo "OpenLdap Killed"
	   else
		echo "OpenLdap Already Killed"
	   fi
   fi
   ;;

*)
   echo "usage: slapd { start | stop }"
   exit 1
   ;;
 
esac
exit 0