I am running a cron job that runs a PHP script every minute ... however my ISP doesnt like that so I will eventually have to change it to every 5 min ... my problem is this the PHP script is going out to a shoutcast server getting the needed information and then writing it to a file for me but when I tell it to run and then sleep for 20 seconds for some reason it doesnt rerun at the 20 second marker it only runs once every minute ... I need it to run the process at least once every 15-20 seconds ... can some one write the loop part of this or explain how I could do this as its the only part of my project that is NOT complete ...


7 Years
Discussion Span
Last Post by FlashCreations

Every 15 seconds? That's a really short interval! It seems like this would add a constant load on the server (therefore taking processing power away from user requests). I suggest you stick to a bit longer of an interval, maybe 10 minutes?

But to create a loop with a delay...

$counter = 0;
  if($counter==100) break;
  sleep(20); //Wait 20 seconds

Edited by FlashCreations: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.