Extracting a Specific Child's Process ID
All:
I have a shell script which runs a java program. Inside this java program I run a java simulation. So the broad picture is: Run Script -> Script initiates a java program -> in this program, there is another java program initiated I would like to get the process id of the last one. Is it possible? I would be more than pleased if somebody could help! |
Have you tried top, or ps -aux or ps -U username
These commands will give you the process ID of programs/scripts and IDs of programs/commands started from scripts as well. |
ps can display the parent process ID, so that if you know how deep you need to go in the tree, and that is apparently the case, you should be able to locate the parent ID with ps and grep and then look for its children in the hierarchy by sed'ing the parent process ID (PPID).
Example: Code:
PARENT=java_parent |
Thanks a lot dv502 and synss.
It worked! :D |
Glad to help...
|
All times are GMT -5. The time now is 01:59 AM. |