But, if I go the way of the fork, the program cannot be broken down into lots of mini-programs which are designed to do a single job.. everything would have to be rolled into one larger program with (I'm guessing here) multiple fork points to handle each different type of system I'm trying to run ...
I *think* I can do it with a wrapper program that launches the new program and reports back the pid, but that doesn't seem right to me ... It seems that this is something that Perl should be able to do, but I can't figure out how to do it ... How about an example ... The main program is called monitor.perl ... While it's running, it spawns a second program called pingit.perl and a third called snmpit.perl ... I want both pingit and snmpit to be able to run concurrently while monitor watches to ensure that those programs don't run too long, don't report back errors, and does some calculations to ensure that it's running efficiently... How do I allow monitor.perl to spawn pingit.perl and snmpit.perl and still continue running itself? On Mon, 2002-11-18 at 16:43, Alan Cameron wrote: > On 18 Nov 2002 15:21:26 -0500, Jason Frisvold <[EMAIL PROTECTED]> wrote: > > [snip] > > > I can't see to figure out how to spawn a new process, return the pid, > > and be able to monitor this new process on my own ... > > The general form would be something like: > > my $pid = fork(); > > if ($pid) { > # I am in the Parent here, do monitoring of the child > } else { > # I am in the child here.. check stuff and send it to the parent > exit 0; # Don't want to continue past what the child should do > } > > Note 1: Error checking is left as an exercise for the reader. > Note 2: If you need more than one child, wrap the whole thing in a loop > of some sort, and use next inside the if() > > -- > Mother is the name for GOD on the lips and > hearts of all children. - Eric Draven -- --------------------------- Jason H. Frisvold Senior ATM Engineer Penteledata Engineering [EMAIL PROTECTED] RedHat Certified - RHCE # 807302349405893 --------------------------- "Something mysterious is formed, born in the silent void. Waiting alone and unmoving, it is at once still and yet in constant motion. It is the source of all programs. I do not know its name, so I will call it the Tao of Programming."
signature.asc
Description: This is a digitally signed message part