NYCPHP Meetup

NYPHP.org

[nycphp-talk] system() call timeout

Nunez, Eddy enunez at tiaa-cref.org
Wed Oct 12 17:08:01 EDT 2005


Fork a child ?  pcntl function calls ??  what if you're running on a webserver,
you're going to fork a huge application just to do a "ls -l" ???

It's always good to have this knowledge on hand but ask yourself do I
really need a bazooka to kill a mouse?

-----Original Message-----
From: talk-bounces at lists.nyphp.org
[mailto:talk-bounces at lists.nyphp.org]On Behalf Of Andrew Yochum
Sent: Wednesday, October 12, 2005 3:28 PM
To: NYPHP Talk
Subject: Re: [nycphp-talk] system() call timeout


On Wed, Oct 12, 2005 at 01:15:19PM -0500, Jeffrey O. Stevison wrote:
> But if the command hangs, the only thing that the time command will  
> do is record how long the program is 'executing' or not for that  
> matter.  I need to term the offensive command and return a code that  
> this has happened.  The reason being I don't want to wait for the  
> system to time out the command as it takes too long to time out.  I  
> would know in a matter of seconds rather than the systems minutes  
> whether the command is hung or not.

Gotcha.

One method might be to use the pcntl_* functions to fork a child, exec the "ls
-la" and wait for the child to exit using a non-blocking waitpid in a loop,
killing the proc if it takes to long or moving on to other business when it
returns.  

HTH,
Andrew
-- 
Andrew Yochum
Plexpod
andrew at plexpod.com
718-360-0879
_______________________________________________
New York PHP Talk Mailing List
AMP Technology
Supporting Apache, MySQL and PHP
http://lists.nyphp.org/mailman/listinfo/talk
http://www.nyphp.org


**************************************************************
This message, including any attachments, contains confidential information intended for a specific individual and purpose, and is protected by law.  If you are not the intended recipient, please contact sender immediately by reply e-mail and destroy all copies.  You are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited.
TIAA-CREF
**************************************************************




More information about the talk mailing list