1758643 Members
2178 Online
108874 Solutions
New Discussion юеВ

'ps' bug?

 
SOLVED
Go to solution
James Burn
Occasional Contributor

'ps' bug?

'ps -efx | grep argument_to_JVM'
works most of the time, but every couple days
fails to return what is expected.
We do this from cron (every five minutes?)
as well as OpenView with an edited template,
on 11.11, and have encountered problems both ways.
Anyone ever seen this before?
Here is a sample of the grep when it works.
We use the 'x' because args to the java runtime are too far out for 'ps -ef'.

Ex.:

ps -efx | grep MultiSendFunnel

Returns mostly:

user 27215 1 0 Sep 24 ? 67:06 /opt/java1.4/jre/bin/PA_RISC2.0/java -classpath /home/jburn/src/java/starter MultiSendFunnel

5 REPLIES 5
James R. Ferguson
Acclaimed Contributor
Solution

Re: 'ps' bug?

Hi James:

You might try 'ps' patch PHCO_31978 if you don't already have it on your server. This patch, in predecessor forms, fixed a coupld of bugs associated with the '-x' option.

No reboot is required to install it.

Regards!

...JRF...
RAC_1
Honored Contributor

Re: 'ps' bug?

While a suggested, you need to check ps patches and see if you get it resolved.
Other thing is not to rely on grep statements.

What you can do is enable XPG4 ps behaviour.

UNIX95= ps -CMultiSendFunnel -o "pid,ppid,ruser,args"

man ps for details.
There is no substitute to HARDWORK
Bill Hassell
Honored Contributor

Re: 'ps' bug?

Java is particularly annoying because of the massively long pathnames. Using the UNIX95 feature in addition to -x may help. The -x option is relatively new but is only good to 1024 characters while a command line might be megs in size. There is also a new feature in the latest ps that uses a special config file: /etc/default/ps that can set the maximum command line width shown by ps.


Bill Hassell, sysadmin
James Burn
Occasional Contributor

Re: 'ps' bug?

Thank You to James, RAC and Bill for the helpfull suggestions. Will try all of the above.
Awesome!

Bill Hassell
Honored Contributor

Re: 'ps' bug?

Just a clarification for the -C option. It refers to the actual command or process name, not arguments. So to isolate just the java-classpath process, yhou would use:

UNIX95= ps -xC java-classpath -o pid,ruser,args

The -C does not use grep, it looks in the process table and performs an exact match on the process name.


Bill Hassell, sysadmin