Hi,
I am actually new to fork(). I tried the following script:
my $child_pid;
if($child_pid = fork()){
system "echo \"kill -9 $child_pid\" >> ttt";
exit 0;
} else {
exec('./XYZ < a.txt');
}
In this case, I store the PID into a file called "ttt" so I can kill it later.
This script does...
Hi Mike,
Thanks for the reply. Is this the only way? Is there an easy way that I can get the PID directly from "System()"? I know "System()" does a fork. Is there a way to get that fork's PID?
Thanks.
Jiang
Hi,
I have the following code
system ("./XYZ");
I know $$ stores the PID of the perl script. However, how can I get XYZ's pid? Is there a way to get that PID immediately? In my case XYZ can take hours to run. I may want to kill this XYZ process before it finishes. I may initiate XYZ...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.