|
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?
|