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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.