[SunHELP] Getting PIDs
Foong, Tzeweng
sunhelp at sunhelp.org
Tue Nov 13 17:45:57 CST 2001
Hello,
Try the -n option
it should get you the last one.
For some other order try using the sort command.
eg
pgrep java | sort -n | tail -1
HTH
Tze Weng Foong
-----Original Message-----
From: Ben Ricker [mailto:bricker at wellinx.com]
Sent: Wednesday, 14 November 2001 7:03 AM
To: Sun Help List
Subject: [SunHELP] Getting PIDs
I have a problem. I administer a Web app that is run through a JVM on
Solaris. We are moving to a failover mod where there will be multiple
JVMs running on one machine. The problem I am having is loggin the PIDs
of the processes. Before, I would start the JVM, sleep for 5 seconds,
the pgrep for 'java' and write the returned PID to a file. Now that
there are two JVMs, both PIDs are being written to the file! I tried
separating them out but no joy.
I am able to get the first JVMs PID written to a file. It is when I exec
the second JVM that I get both PIDs written because there are two JVMs
running. I thought I could do some sort of compare of the two PIDs
returned to the file and only write the sequentially later PID, but I am
uncertain how to do that. Any direction would be most appreciated.
Ben Ricker
System Administrator
Wellinx.com
_______________________________________________
SunHELP maillist - SunHELP at sunhelp.org
http://www.sunhelp.org/mailman/listinfo/sunhelp
More information about the SunHELP
mailing list