I have a file on the server that extract some data from pages, like a crawler. Ok, now, sometimes, the execution of the script takes 5 seconds, but sometimes takes even 1 minute or 2.
Setting a cron job for accessing the file at 2, 3, or 5 minute is not comfortable for me, because I need this crawler to run as fast as possible.
So my question is:
Can I set a cron job to run, let's say, every 5 minutes and set php to re-run the script again and again and again ?
More clear:
*/5 * * * * wget -O - site.com/index.php?cron >/dev/null 2>&1
index.php?cron
function cron_action()
{
//some action here
// Call again the function
cron_action();
}
cron_action();
As I don't understand very well how does cron job react at my script, I don't know either what will happen when, on another 5 minutes, the cron job will acces the url again.
I will be in a infinity loop ?
How you would do that ? I need some advices please. I really need to set the cron job run faster and, in my opinion, the functions from php must be recalled forever.