Operating System - HP-UX
1849839 Members
2355 Online
104044 Solutions
New Discussion

process identification with long process names

 
Geoff Hartnell
Advisor

process identification with long process names

On HPUX11, I am regularly finding that Tomcat does not stop when the script 'tomcat.sh stop' is invoked - does anybody know why this would be ?

In order to be sure that Tomcat is stopped by a script, before issuing 'tomcat.sh stop' we attempt to identify the tomcat process with the ps command. Then after 'tomcat.sh stop' we check that the process has gone.

However, we are finding that the command string returned from 'ps -fu' gets truncated, so when the tomcat invocation occurs from a long path we are unable to identify the tomcat process and therefore unable to stop it.

Has anyone got a working solution to this problem ?

Thanks

Geoff
4 REPLIES 4
David Lodge
Trusted Contributor

Re: process identification with long process names

The process name will always get truncated in the PS listing as the full string isn't stored within the kernel tables.

The way I normally work around this is to amend the startup script to place the pid of the process in a file and then check that, eg:

[startup script]
...
processd
print ${!!} >/var/run/processd.pid
...

[checking]
...
Pid=$(ps -fp ${Pid} && print "Process still running"
...

HTH

dave
John Carr_2
Honored Contributor

Re: process identification with long process names

Hi

you could always move tomcat to another directory ( shorter path ) and create a symbolic link to it , the hey presto it will appear in the ps listing.

ps truncates there is no way to manipiulate the command to increase the length ot output.

cheers
john.
Jordan Bean
Honored Contributor

Re: process identification with long process names

We have to invoke `tomcat.sh stop` at least twice here to make it terminate gracefully. I'll be sure to post a reason or fix as soon as I know why this so.
Darrell Allen
Honored Contributor

Re: process identification with long process names

Hi Geoff,

Maybe you can use:
UNIX95= ps -fC processname

See Bill Hassell's answer in:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xdf541012aa92d5118ff10090279cd0f9,00.html

Search the forums for more examples and comments.

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)