Continually running PHP script using Bash

I have a long running PHP script that has a memory leak which causes it to fail part way through. The script uses a 3rd party library and I haven't been able to find the source of the leak.What I would like to do is create a bash script that continually runs the PHP script, processing 1000 records at a time, until the script returns an exit code saying it has finished processing all records. I figure this should help me get around the memory leak because the script would run for 1000 records, exit, and then a new process would be started for another 1000 records.I'm not that familiar with Bash. Is this possible to do? How do I get the output from the PHP script?In pseudocode, I was thinking of something along the lines of:\[code\]do: code = exec('.../script.php') # PHP script would print 0 if all records are processed or 1 if there is more to dowhile (code != 0)\[/code\]
 
Back
Top