Re: [PHP] Run script every 30 seconds



On Mon, October 30, 2006 11:29 am, Ahmad Al-Twaijiry wrote:
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 ?

Run a script that never quits with:
http://php.net/usleep

while (true){
//your script here
usleep(30000); //30000? rtfm.
}

It won't really really be every 30 seconds, because the script itself
takes time, but it's about as close as you are likely to get without a
ton of probably un-needed work...

--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?
.



Relevant Pages

  • Re: cronjob in user environment
    ... The script foo.sh to be run by cron on behalf of the a user ... I get the message "su must be run from a terminal" in the cron mail. ... I would use 'crontab -e' as the user to define the cronjob. ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • Long cronjobs terminate after 2 minutes/Ubuntu 8.10
    ... I use a cronjob to backup several directories on a Ubuntu 8.10 system. ... When I run the script in the foreground, it takes about 2 hours to complete, ... The top command displays the job running, ...
    (Ubuntu)
  • Re: [PHP] Run script every 30 seconds
    ... Ahmad Al-Twaijiry wrote: ... I have a script that I want it to run every 30 seconds, ... that cronjob can run every 1 minute only, ... Dot Com Holdings of Buffalo ...
    (php.general)
  • Re: shell script wir nicht vollstaendig abgearbeitet, wenn Aufruf uebr crontab erfolgt
    ... Und jetzt kommts: Wird das Script über einen cronjob aufgerufen: ... Im Einsatz ist Ubuntu 7.10. ... oder den Cronjob so aufrufen: ... was im debug-output der Shell steht. ...
    (de.comp.os.unix.shell)
  • Re: Setting up a cron job from within a PHP script
    ... The cron job loads and the sendMail file executes in roughly two ... your PHP script should not be specifying what command to run - ... Let that cronjob call your 'cronjob' php script every hour or every 5 ...
    (comp.lang.php)