[99828] in RedHat Linux List

home help back first fref pref prev next nref lref last post

getting the PID just spawned

daemon@ATHENA.MIT.EDU (Justin Kuntz)
Tue Nov 17 08:40:15 1998

From: "Justin Kuntz" <jkuntz@prominic.com>
To: redhat-list@redhat.com
Date: Tue, 17 Nov 1998 07:39:25 -0600
Resent-From: redhat-list@redhat.com
Reply-To: redhat-list@redhat.com

I am writing a Java RMI server for Red Hat v5.1 that spawns some child
processes to help "administer" the Linux system from remote / other OSes /
Java objects living elsewhere on the internal network.  IE:

Process p = null;
try {
  p = Runtime.getRuntime().exec( command);
  p.waitFor();
  System.out.println( "Exit value is: " + p.exitValue());
}

I would like to know how to get the exitValue of the spawned process to be
equal to the Process ID that was just assigned.

For example, say I issue a command like:
command =  "/usr/sbin/named -b /var/named/internal/named.boot"

I would like for my p.exitValue() call to equal the PID that I just
spawned.  The reason I am asking this question in the forum is because I
know there are a lot of shell programming experts here... and really all my
program is doing is issuing a shell command and looking at the return
value.

Thanks,

Justin



-- 
  PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
		http://www.redhat.com http://archive.redhat.com
         To unsubscribe: mail redhat-list-request@redhat.com with 
                       "unsubscribe" as the Subject.


home help back first fref pref prev next nref lref last post