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
Licencia de Creative Commons
Programación Distribuida y Mejora del Rendimiento
por Casiano Rodríguez León is licensed under a Creative Commons Reconocimiento 3.0 Unported License.

Permissions beyond the scope of this license may be available at http://campusvirtual.ull.es/ocw/course/view.php?id=44.
2012-06-19