View Single Post
Old 08-31-2004, 07:40 AM  
Dusen
Confirmed User
 
Join Date: Aug 2002
Location: East Coast.
Posts: 2,251
Linux Gurus - Problem

I'm exec()'ing a bourne shell program from PHP. For the moment, it is not possible to port this shell program to php. I also do not have access to the source.

The shell program is fed instructions from the php file which grabs them from a ascii file. The simplified php process is:

while not eof datafile
{
fgets(arg)
exec(program arg)
}

However, executing the program sometimes gets locked into loops where it will just sit there. I want to have some way to put a time limit.

Setting the script to call another php script (that only execs the program) with a maximum exec time will not work - max times are only while inside the php script.

And the bash ulimit can only control processor time used, not actually kill the program, correct?

Ideally I'd like do run something like:

exec (./timelimit5 program arg)

which would just kill the process if it exceeds 5 seconds.

But I'm lost. Any suggestions?
__________________
Penis Pill Sponsor List and Reviews:
http://www.pillsponsors.com
Dusen is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote