[WBEL-users] Wierd pidof behavior

Johnny Hughes mailing-lists@hughesjr.com
Mon, 01 Mar 2004 20:24:40 -0600


On Mon, 2004-03-01 at 09:54, Aaron Smith wrote:
> 	So here's a strange one.  We have WB 3.0 installed on a machine
> here
> that runs various perl scripts as backends.  The other machines have
> Redhat 7.3 on them.  We run a init type script to start and stop the
> various perl scripts that run and this script uses "pidof" to find the
> PID's of the various processes.  In order to make sure we're affecting
> the correct processes, it calls pidof with the full pathname of the
> script we're looking for.
> 	The strange thing that we've noticed with Whitebox is that this
> doesn't
> work the same way, but only for certain users.  If we have a running
> script that is called, say, /usr/bin/script.pl, which is running as user
> "someuser" and "somegroup" and you run this command:
> 
> someuser> pidof /usr/bin/script.pl
> 

This doesn't solve your problem with pidof .... but it will give you the
PID(s) of a running process(es) (I will use /usr/bin/script.pl as in
your example):

ps -ef | grep /usr/bin/script.pl | grep -v grep | awk '{print $2}'

> 	You get nothing.  *IF* you run it as the user the process is
> running
> as.  If you run the exact same command as a different user, you get the
> correct PID.  The REALLY bizzare part is that if you run that very same
> command as ROOT, you once again get nothing.
> 	These "feels" like some kind of permissions problem, but I can't
> for
> the life of me think of why ROOT would not have permission to find a PID
> for a process!