I installed initscripts-4.83-1.i386.rpm and after rebooting, I noticed that some of the services started from /etc/rc.d/init.d had failed to start, including sendmail and nfs. I ran /etc/rc.d/init.d/sendmail start manually, and it still didn't start. Finally I ran /usr/sbin/sendmail -bd -q1h, and sendmail worked fine. I backed off to initscripts-4.82-1.i386.rpm and the problem went away. Probably something trivially wrong with one of the sourced scripts, but I didn't have time to investigate further. I saw this on a system running rpms that were all current with the latest RawHide rpms as of 2000/01/22 1200PST.
Yup, known bug, fixed in initscripts-4.84.
I suppose the fix in initscripts-4.84 is functional, but it's not how I would have fixed it. In fact, it's not how I *did* fix it :-). I realize that you need to have the "for apid in $pidlist" code in daemon and killproc because if you put it in pidofproc it's actually running in a subprocess and therefore doesn't do the right thing (i.e., it keeps a pid in the list which shouldn't be in the list). But this special-case code is gross and doesn't fix the underlying problem that pidofproc is returning bogus information. Here's how I fixed it: --- functions 2000/01/25 22:38:54 1.1 +++ functions 2000/01/25 23:47:20 @@ -12,6 +12,27 @@ # First set up a default search path. export PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin" +# Unfortunately, the "pidof -x" invocations below will find this +# script if it has the same name as the process being checked or +# killed. To avoid this, we want to give pidof a list of process IDs +# to ignore. More unfortunately, this is not as simple as just +# telling it to ignore our PID, because we may be in a subprocess of +# the actual script, e.g., because of a shell function run inside +# backquotes. Even more unfortunately, such a subprocess returns the +# PID of the base process when $$ is evaluated, rather than returning +# the PID of the subprocess, so there's no easy way to get the PIDs of +# such subprocesses to exclude them. To surmount these obstacles, use +# some awk magic to get all the PIDs in a chain from the current PID +# back to $$. + +AWK_PROG='NR == 1 { self=$1 } +{ parent[$1] = $2 } +END { while (self != upto) { self=parent[self]; print "-o " self } }' + +exclude_pids () { + ps -A --format '%p %P' | awk "$AWK_PROG" upto=$$ /dev/pid - +} + # Get a sane screen width [ -z "$COLUMNS" ] && COLUMNS=80 @@ -170,7 +191,7 @@ fi # Next try "pidof" - pid=`pidof -x $1` + pid=$(pidof $(exclude_pids) -x $1) if [ "$pid" != "" ] ; then echo $pid return 0 @@ -185,7 +206,7 @@ fi # First try "pidof" - pid=`pidof -x $1` + pid=`pidof $(exclude_pids) -x $1` if [ "$pid" != "" ] ; then echo "$1 (pid $pid) is running..." return 0