DJ Lucas wrote:

>>> Never mind.  $$ is not actually incrementing, but I don't know what
>>> processes pidof is finding when running that script.  Creating a second
>>> functions script with only statusproc and getpids using the same 'pidof
>>> -o $$ -o $PPID -x "${1}"' gives the proper result.  It looks as if pidof
>>> it's finding it's own PID but that can't be either because it does not
>>> find itself in the second example.  I'm at a loss.  Will revisit after
>>> some sleep.

Okay..I'm not sure how (if) this affects the LSB function for pidofproc,
but it does do the right thing with the output.  I've still not tested
this thouroughly, expecially WRT pidofproc!!!

-- DJ Lucas
--- lfs-bootscripts-3.2.2-orig/lfs/init.d/functions	2005-07-05 01:09:05.000000000 -0500
+++ lfs-bootscripts-3.2.2/lfs/init.d/functions	2005-08-08 18:53:52.000000000 -0500
@@ -426,7 +426,7 @@
 {
 	local pidfile=""
 	local lpids=""
-	local pidlist=""
+	pidlist=""
 	while true
 	do
 		case "${1}" in
@@ -455,20 +455,20 @@
 			return 3 # Program is not running
 		fi
 
-		lpids=`head -n 1 ${pidfile}`
-		for pid in ${lpids}
+		lpids=`head -n 1 "${pidfile}"`
+		for pid in "${lpids}"
 		do
 			if [ "${pid}" -ne "$$" -a "${pid}" -ne "${PPID}" ]; then
 				kill -0 "${pid}" > /dev/null &&
 				pidlist="${pidlist} ${pid}"
 			fi
-			echo ${pidlist}
+			echo "${pidlist}"
 			test -z "${pidlist}" && return 1 # Program is dead, pidfile exists
 			return 0
 		done
 
 	else
-		pidof -o $$ -o $PPID -x "${1}"
+		pidlist=`pidof -o "${$}" -o "${PPID}" -x "${1}"`
 	fi
 
 	if [ "$?" != "0" ]; then
@@ -479,10 +479,10 @@
 # This will ensure compatibility with previous LFS Bootscripts
 getpids()
 {
-	if [ -z "${PIDFILE}" ]; then
-		pidlist=`pidofproc -p "${PIDFILE}" [EMAIL PROTECTED]
+	if [ -n "${PIDFILE}" ]; then
+		pidofproc -p "${PIDFILE}" "[EMAIL PROTECTED]"
 	else
-		pidlist=`pidofproc [EMAIL PROTECTED]
+		pidofproc "[EMAIL PROTECTED]"
 	fi
 	base="${1##*/}"
 }
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to