Hello Everyone,

I am trying to spawn a program from my perl script - and later on I 
would like to kill it. How do I go about doing this?

The approach I have adopted for now is as follows:

Within the perl script:
system($command . ' &');
to put the command in the background.

And later, when it is time to kill the process:
my $pid = `ps -aef | grep $command | grep -v grep | awk \'{print \$2}\'`;
kill 9, $pid;

However this seems like an extremely complicated way to do this. 
Ideally, when I am putting the command in the background I would like to 
record the process-id. So later on I can just kill 9, $pid.

Does anyone have any idea? I was researching the "fork" command - but 
had completely no idea about what the manpage was talking about.

Thanks.

Shouri

--~--~---------~--~----~------------~-------~--~----~
Do you have another question? Click here - 
http://groups.google.com/group/iitdlug/post
l...@iitd community mailing list -- http://groups.google.com/group/iitdlug
-~----------~----~----~----~------~----~------~--~---

Reply via email to