Hide Forgot
I apologize in advance for the length of this report. Please feel free to email me at mmchen@minn.net if any of this does not seem clear. This bug regards the subroutine called 'pidofproc' in the file /etc/rc.d/init.d/functions. This subroutine is responsible for determining the pid of a process for the init.d start/stop scripts if all else fails. Under certain circumstances this script will not work as it should. Take a look at this line from /etc/rc.d/init.d/functions, specifically the last check in pidofproc: # Finally try to extract it from ps ps auxw | awk 'BEGIN { prog=ARGV[1]; ARGC=1 } { if ((prog == $11) || (("(" prog ")") == $11) || ((prog ":") == $11)) { print $2 ; exit 0 } }' $1 Now take a look at a "typical" ps auxw (shortened up) root 515 0.4 0.0 720 216 ? S Feb 28 38:31 update (bdflush) root 1563 0.0 0.1 856 472 ? S 04:02 0:00 CROND root 1718 0.0 0.4 1552 1044 ? S 04:02 0:00 /usr/sbin/sendmail -FCronDaemon -odi -oem -or0s root root 1732 2.8 0.3 1644 900 ? S 04:02 29:49 perl /etc/mail/popauth.pl Basically the pidofproc routine looks in the 11th column for a "running program" and considers anything surrounded by spaces a column. As you can see running 'pidofproc update' will NOT return 515 as it should because of the extra space introduced by "Feb 28". Hopefully this is making some sense :) Another case which might cause problems is shown in the last line but I won't go into that one as most people are probably not running scripts out of init.d. Granted most daemons/init programs should have a PID associated with them in /var/run and if they do the problem with pidofproc will never become an issue. There are alot of possibilities for things to slip through the cracks though. I would suggest modifying the line from pidofproc as follows: # Finally try to extract it from ps ps ax | awk 'BEGIN { prog=ARGV[1]; ARGC=1 } { if ((prog == $5) || (("(" prog ")") == $5) || ((prog ":") == $5)) { print $1 ; exit 0 } }' $1
fixed in a later initscripts (probably around 3.94 or so.)