Re: [PHP] Run script every 30 seconds
- From: mitch@xxxxxxxxxxxx (Mitch Miller)
- Date: Mon, 30 Oct 2006 12:57:35 -0600
Or, you could run two scripts every minute ... one that starts immediately, and one that sleeps for 30s before starting.
-- Mitch
Dave Hamber wrote:
You could run the script as a daemon. man daemon..
The sloppy way of running the script every 30 seconds would be to use sleep(30), but that would cause the script to run at 30 seconds + execution time.
If you make a loop like this you could get around that:
$t=time()+31;
while(true){
if(time()>$t+30){
$t=time();
YourMainScriptFunction();
}
else usleep(1000); //adjust to how often you want to check
}
On 30/10/2006 17:29 Ahmad Al-Twaijiry wrote:
Hi everyone,
I have a script that I want it to run every 30 seconds, the problem is
that cronjob can run every 1 minute only, do you have any solution ?
- References:
- Run script every 30 seconds
- From: "Ahmad Al-Twaijiry"
- Re: [PHP] Run script every 30 seconds
- From: Dave Hamber
- Run script every 30 seconds
- Prev by Date: Re: [PHP] Run script every 30 seconds
- Next by Date: Re: [PHP] Run script every 30 seconds
- Previous by thread: Re: [PHP] Run script every 30 seconds
- Next by thread: Re: [PHP] Run script every 30 seconds
- Index(es):
Relevant Pages
|