Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How can I run a PHP script every few seconds in Ubuntu Server? (bonus: How can I run random within the cron script, e.g. every 3 seconds + random(3 seconds) )

share|improve this question
1  
I'd recommend that you first evaluate whether you actually need such short intervals. There's a reason they are discouraged, after all. –  FEichinger Aug 19 '13 at 21:40
add comment

1 Answer

cron only runs at intervals of one minute or longer. If you really need, you could create a script of some sort that repeats whatever needs doing in a loop and sleeps for 3 seconds between iterations. But There's likely a better means to whatever ends you're actually trying to achieve.

share|improve this answer
    
you mean a minimum –  Max Aug 19 '13 at 21:32
    
How would such a script look? –  Max Aug 19 '13 at 21:38
    
Something along the lines of while(true){do_something();sleep(3);}. –  Kevin Aug 19 '13 at 21:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.