General
cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with truncation using ps

Mr Peter Kempner
Occasional Contributor

Problems with truncation using ps

Please Help

I am writing a v simple shell script to check that several known processes are running. eg j_event_handler.exe

I am basing the script on the following syntax:

ps -e|grep j_event_handler.exe

The problem is that the output is truncated to 14 chars (see middle entry below) This is not specific enough for us.

4918 pts/tA 0:00 telnetd
8386 pts/tI 0:00 j_event_handle
8536 pts/tr 0:00 g_orderproc.ex

I have tried other formats of ps but with similar probs.

We use HP-UX11, Korn Shell, and Reflections terminal Emulation.

If anyone knows how to get round this I would be v . grateful

Pete
7 REPLIES
Vincenzo Restuccia
Honored Contributor

Re: Problems with truncation using ps

ps -e|grep "j_event_handler.exe"

federico_3
Honored Contributor

Re: Problems with truncation using ps

James R. Ferguson
Acclaimed Contributor

Re: Problems with truncation using ps

Hi:

You are stuck with what you have. As the man pages for 'ps' note:

"Only a subset of the command line is saved by the kernel; as much of the command line will be displayed as is available".

...JRF...
Cheryl Griffin
Honored Contributor

Re: Problems with truncation using ps

ps has a line length cap at 60 characters, not 14.

This is more of a symptom of ps -e.

As an alternate, try ps -ef.

"Downtime is a Crime."
Mr Peter Kempner
Occasional Contributor

Re: Problems with truncation using ps

Thanks for your help. It looks like it is a limitation of the command/kernel - One answer that I was refered to does seem like a potential answer but I do not understand it! Can anyone interpret the below (eg set UNIX95= to what??, plus -o flag doesn't work)


"Set the environment variable UNIX95=. Then issue the ps -eoruser,vsz,pid,args command. This will list more of the args command
Have Fun."
federico_3
Honored Contributor

Re: Problems with truncation using ps

In many situations it's necessary to identify a process's hierarchy.This can be done like the following:
export UNIX95=true
ps -H

Federico
Mr Peter Kempner
Occasional Contributor

Re: Problems with truncation using ps

AAAaaaaaahhhhhh

Thanks Federico. With your help, I tried the following:

export UNIX95=true
ps -eoargs

It leads to the output shown below

/edp/ingres_apps/converted/planning/compiled/j_event_handler

Ie Although I have now restricted the columns output, it is still truncating (the actual name is j_event_handler.exe.


Pooh