pidofproc function in functions script

dennisjperkins at comcast.net dennisjperkins at comcast.net
Mon Jul 2 12:03:11 PDT 2007


 -------------- Original message ----------------------
From: "Dan Nicholson" <dbn.lists at gmail.com>
> On 7/1/07, Dennis J Perkins <dennisjperkins at comcast.net> 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:
> 
> http://downloads.linuxfromscratch.org/lfs-bootscripts-20070420.tar.bz2
> 
> 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}
		do
			if [ "${pid}" -ne "$$" -a "${pid}" -ne "${PPID}" ]; then
				kill -0 "${pid}" > /dev/null &&
				pidlist="${pidlist} ${pid}"
			fi
			
			if [ "${silent}" -ne "1" ]; then
				echo "${pidlist}"
			fi

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

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