Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capture PID on HP-UX

Status
Not open for further replies.

newDBA

MIS
Nov 8, 2001
21
FR
I need to be able to capture the PID of a new Java process as it is started. Is there a way to somehow execute a java application in HP-UX and capture the PID for that process?
 
yes, if you launch a process to run in the background you can get at the PID of that process.

Using the korn shell (ksh) do this:
[tt]
java_process &
JAVA_PID=$!
print $JAVA_PID > /tmp/pid_of_java_process.tmp
wait
[/tt]

This stores the PID of the java process in the file /tmp/pid_of_java_process.tmp and then waits for the java process to finish as if you'd just called it normally in the script.

If you don't need to wait for the java process to finish - don't call wait. Mike
"Experience is the comb that Nature gives us after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top