Re: Killing a process that takes too long
- From: tom@xxxxxxxxxxxxxx (Tom Phoenix)
- Date: Tue, 21 Nov 2006 11:27:37 -0800
On 11/21/06, Jen Spinney <jen.spinney@xxxxxxxxx> wrote:
I want to make a system call, and then kill the process if it takes
too long.
So, if I do a ps -af, I can see that my perl script is a goner, but
the process spawned from the system call is still alive.
Yes; if you use system() to start a sub-process, you're letting perl
manage it; so there's no way to get the process-ID.
You may instead use fork and exec; this lets you use the process-ID to
manage the process directly. Be sure to use wait or waitpid to reap
the completed child process, so as not to leave zombies.
Is that what you needed? Hope this helps!
--Tom Phoenix
Stonehenge Perl Training
.
- Follow-Ups:
- Re: Killing a process that takes too long
- From: Jen Spinney
- Re: Killing a process that takes too long
- References:
- Killing a process that takes too long
- From: Jen Spinney
- Killing a process that takes too long
- Prev by Date: Re: Killing a process that takes too long
- Next by Date: search and replace basics
- Previous by thread: Re: Killing a process that takes too long
- Next by thread: Re: Killing a process that takes too long
- Index(es):