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

Re: process table



Yeah, it's pretty silly that RH's 'killproc' function return failure
when the processes have been killed, huh?

Here's what I'm doing.

# the following assumes your slapd is run with -u ldap
install -d -o ldap -g ldap -m 755  /var/run/slapd
ed /etc/openldap/slapd.conf <<EOF
/pidfile/c
pidfile /var/run/slapd/slapd.pid
.
w
q
EOF

Then check out this diff from the 'stop()' section of /etc/init.d/ldap.

diff -c /etc/init.d/ldap /etc/init.d/ldap.rh 
*** /etc/init.d/ldap	Wed Aug  7 17:05:02 2002
--- /etc/init.d/ldap.rh	Wed Aug  7 16:46:53 2002
***************
*** 61,77 ****
          # Stop daemons.
  	prog=`basename ${slapd}`
  	echo -n $"Stopping $prog: "
! 	# the openldap manual says do it this way
! 	# http://www.openldap.org/doc/admin21/runningslapd.html#Stopping%20slapd
! 	kill -INT `cat /var/run/slapd/slapd.pid`
! 	sleep 2;  # wait for things to clean up
! 	RETVAL=0
! 	if ! [ `ps -C fslapd --no-headers | wc -l` -eq 0 ]; then
! 	    killproc ${slapd}
! 	    RETVAL=$?
! 	else
! 	    echo_success; # print out the nifty colored 'OK' message
! 	fi
  	echo
  	if [ $RETVAL -eq 0 ]; then
  	    if grep -q "^replogfile" /etc/openldap/slapd.conf; then
--- 61,68 ----
          # Stop daemons.
  	prog=`basename ${slapd}`
  	echo -n $"Stopping $prog: "
! 	killproc ${slapd}
! 	RETVAL=$?
  	echo
  	if [ $RETVAL -eq 0 ]; then
  	    if grep -q "^replogfile" /etc/openldap/slapd.conf; then


This works for me.  Let me know if you've got a better idea.

	John



On Tue, Aug 06, 2002 at 05:10:02PM +0100, Andrew Findlay wrote:
> On Tue, Aug 06, 2002 at 07:54:52AM -0400, Andrew Bacchi wrote:
> > /etc/init.d/ldap: kill: (29844) - No such process
> > /etc/init.d/ldap: kill: (29843) - No such process
> > /etc/init.d/ldap: kill: (29842) - No such process
> > /etc/init.d/ldap: kill: (29841) - No such process
> > /etc/init.d/ldap: kill: (29838) - No such process
> > /etc/init.d/ldap: kill: (29835) - No such process
> > /etc/init.d/ldap: kill: (29834) - No such process
> 
> It would be better if /etc/init.d/ldap caused SLAPD to write a PID
> file at startup, and then used that at shutdown time to decide which
> process to kill.