pidofproc function in functions script

dennisjperkins at dennisjperkins at
Mon Jul 2 12:03:11 PDT 2007

 -------------- Original message ----------------------
From: "Dan Nicholson" <dbn.lists at>
> On 7/1/07, Dennis J Perkins <dennisjperkins at> wrote:
> > I was reading how the bootscripts currently work, and I saw something
> > that seems wrong. I think lines 453-457 should be after the for loop
> > instead of inside it, otherwise the loop would only do one pass.
> Which version of the bootscripts? I made some changes a couple months
> ago, so you may want to look at the newest version:
> Could you give a little more context to what part of the function that is?
> --
> Dan
> -- 

I think I looked at the latest version, but I have a printout of the functions file and this is what it has:

		for pid in ${lpids}
			if [ "${pid}" -ne "$$" -a "${pid}" -ne "${PPID}" ]; then
				kill -0 "${pid}" > /dev/null &&
				pidlist="${pidlist} ${pid}"
			if [ "${silent}" -ne "1" ]; then
				echo "${pidlist}"

			test -z "${pidlist}" && 
			# Program is dead, pidfile exists
			return 1
			# else
			return 0

Shouldn't done be before the comment line that says the program is dead?

Maybe you can clarify the first if statement in this loop.  I looked at the few pidfiles on my computer.  None of them seems to indicate a need for $$ and $PPID.  Maybe my system is not complex enough, but why should we ever expect to see them in a pidfile?

More information about the lfs-support mailing list