LFS Bootscripts

DJ Lucas dj at linuxfromscratch.org
Sun Aug 7 21:22:54 PDT 2005


DJ Lucas wrote:
> Randy McMurchy wrote:
> 
> 
>>It reports that the daemon is running with such-and-such PID, but
>>that PID really doesn't exist except at the moment the status was
>>checked.
> 
> 
> IIRC, in the past, we had used the -x switch to pidof and that was
> removed in favor of '-o $PPID -o $$'.  The -x should definately be
> removed as this would be broken with backround scripts (popbeforesmtp is
> the only example I can come up with right off the top of my head.  It's
> written in perl and would fail to show with -x).  Now both are used with
> the LSB style pidofproc function.  Will test with all shells and get
> back in a few moments regarding $$ and $PPID to see if that is possibly
> the issue.  Randy what shell is linked to /bin/sh on your system?
> 
> Anyway, there is definately a bug if it's returning the PID of the
> running script, but there is also a problem in your script as you should
> be passing the full path of the binary to statusproc; Well, unless that
> is a symlink in which case pidof will find the PIDs of the target.
> 
> -- DJ Lucas

$PPID is not valid in csh.  Not very likely that is the problem however,
still digging.  This is interesting.  I've edited my sshd script.  Here
is a snippet:

        status)
                echo "PID of current script is $$"
                echo "Parent PID is $PPID"
                echo "This is the statusproc of sshd"
                statusproc sshd
                echo "This is the statusproc of /usr/sbin/sshd"
                statusproc sshd
                ;;


Now, running that script produces this:

[root at name1 dj]# /etc/rc.d/init.d/sshd status
PID of current script is 29208
Parent PID is 28947
This is the statusproc of sshd
sshd is running with Process ID(s) 29211 3232.
This is the statusproc of /usr/sbin/sshd
sshd is running with Process ID(s) 29213 3232.

And again:

[root at name1 dj]# /etc/rc.d/init.d/sshd status
PID of current script is 29222
Parent PID is 28947
This is the statusproc of sshd
sshd is running with Process ID(s) 29225 3232.
This is the statusproc of /usr/sbin/sshd
sshd is running with Process ID(s) 29227 3232.

Notice the increment of $$?

Something is odd there that I don't quite see just yet.
That's three different (nonsequential) incarnations of bash, that should
have never changed. Something with subshells maybe????  Anyone have any
ideas?

Randy, my functions are heavily modified ATM.  To make sure that this is
not a different issue, can you run the same test and post back? It
doesn't matter which script, just use one that is running.

Thanks.

-- DJ Lucas



More information about the lfs-dev mailing list