Answer the question
In order to leave comments, you need to log in
Execute php script every 10 seconds?
Guys, such a question.
You need to execute a php script every 10 seconds.
How can I do it?
I now have 3 options for solving this problem:
1. https://habrahabr.ru/post/132609/
2. according to the crown, but so that the script works during. And run the script once a minute.
3. Arrange a message queue, but I still don't know how to do it at all.
Please let me know which would be the best option. Or maybe you have another solution?
I have my own server, problems with the load and other things should not arise!
Answer the question
In order to leave comments, you need to log in
several types of crowns
* * * * * php myscript.php
* * * * * sleep 10 && php myscript.php
* * * * * sleep 20 && php myscript.php
* * * * * sleep 30 && php myscript.php
* * * * * sleep 40 && php myscript.php
* * * * * sleep 50 && php myscript.php
Make one cron, for every minute, and then add your status check to the script.
So at the first call, you will start the process and save the state somewhere. After that, if it takes a long time to run, the second request will first check your status, if it says that I'm still running, then it will complete the call, otherwise it will execute .
You can implement it yourself, I personally use the symphony package - LockHandler
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question