Práctica: El PID de un Subproceso

Intente dar respuesta a la siguiente pregunta enviada a Perl Mongers: Executing a process in the background AND getting its pid

Executing a process in the background AND getting its pid

Hi all!

I need to execute the process "P" in the background. I suppose I can execute P in the background by saying

                        system "P &"

or by using fork and exec. However, my perl script need the pid of P in order to communicate with it (P creates logfiles whose names contain P's pid, and the perl script need to read these files). How do I get P's pid? I tried to use fork, but then of course I only got the pid of the new perl process. What I need is the pid of the P process.

Thanks,

Henrik
Comente las respuestas que se encuentran en Perl Mongers.



Subsecciones
Casiano Rodríguez León
2012-02-29