Re: [PHP] Run script every 30 seconds
Sorry, slight adjustment, make that $t=time()-31; in the first line so
that the script runs immediately.
> 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 ?
.
Relevant Pages
- Re: Confused about init scripts expectations
... I am developing a daemon application to handle datalogger ... I have developed the init script that is ... I attempt to start the daemon using the services configuration GUI ... figure is that the EOF signal is not being received by the program. ... (Fedora) - Re: [opensuse] BASH: has $COLUMNS gone nuts?
... You do realize that lines & columns are dynamic values which at least some terminals and login daemons will continuously adjust right? ... What the above shows is that I dragged the corner of my PuTTY window (which was connected to sshd, not every terminal client nor every server daemon does this) making the window a little larger and without issuing any commands, and no possibility that any bashrc or inclusions got executed, the values changed, because the terminal told the daemon and the daemon told it's child processes. ... Try calling them from within a script: ... Although, I would also actually be perverse and say that since the SCO systems predate most others, including ALL linux, that you could actually make the argument that the dwindling remaining production sco boxes in the world are right and the 90 million linux & freebsd & sun boxes are all wrong. ... (SuSE) - Re: script "chaining"
... If a task (such as a report) would take too long to run while attached to the browser, the current system writes the data to a database file. ... The daemon checks that file every 10 seconds and executes the task, writing the data back to database. ... If you take the A out of LAMP you can write a php script like a bash script or a perl script and execute it. ... (comp.lang.php) - Debian PHP jabber client deamon
... to prevent PHP stopping the script. ... // disconnect from the Jabber server ... Here's the daemon script for running it in Debian. ... # Gracefully exit if the package has been removed. ... (comp.lang.php) - Re: script "chaining"
... bill wrote: ... If a task would take too long to run while attached to the browser, the current system writes the data to a database file. ... The daemon checks that file every 10 seconds and executes the task, writing the data back to database. ... If you take the A out of LAMP you can write a php script like a bash script or a perl script and execute it. ... (comp.lang.php) |
|