I cant use a cron for this task as the script should always be running.
I have a loop that does the following:
1) Gets a SQL row
2) Runs the values through some functions
3) stores new values
4) gets the next row and repeats
This script has to always be running 24/7 to update profiles on my website.
Now I've considered something similar to:
<?php
ignore_user_abort(1); // run script in background
set_time_limit(0); // run script forever
do{
// add the loop functions here
// ...
}while(true);
?>
but I'm looking for any advice as to how I should have this loop running in the background. This is Ubuntu 10.04 LTS and I'm very new to linux.
The process will eventually be executing for 500 - 1000 rows and each execution takes between 0.001 and 10.00 seconds. (90% of the rows take less than 0.05 seconds to execute).
Perhaps there is a way to do 25 - 50 rows in one load and loop through all SQL records 20 - 50 at a time? Or should I stick to individual row execution?
Thanks in advance!