Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Create your normal function to do whatever it is you need to do and then use something like <a href="http://www.unixgeeks.org/security/newbie/unix/cron-1.html" rel="nofollow noreferrer"><code>cron</code></a> to set it up as a task to run every X amount of time.</p> <p><strong>Edit to expand on comments</strong></p> <p>In that case you are probably better off combining a few solutions. As mentioned in <a href="https://stackoverflow.com/questions/1778540/execute-php-script-every-40-miliseconds">this question</a>, I would recommend that you use cron to call a script every minute and in that script you run your process in a loop.</p> <p>Some things to consider: </p> <ul> <li>How long will each execution take?</li> <li>Will you need to time_sleep_until at the end of each loop or will your script take longer than 1 second to run, in which case you will need to be calling the script multiple times from cron.</li> <li>Be sure to keep track of how long your script has been running for as you don't want to have the situation where every minute you are taking up more and more resources as the script called the previous minute hasn't finished yet.</li> </ul> <p>At the start of the script, take note of the current time, then at the start of each loop, check whether a minute has passed since the start of the script, if it has, exit the script (as another script will have taken over now thanks to cron).</p> <p>Hope this helps. Let me know if this doesn't make a lot of sense and I'll try to clear it up a bit.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload