Is it right to run bash- script with such a delay?
while true; do php -f /.../script.php sleep 0.5 done Is it right to run bash- script with such a delay?
while true; do php -f /.../script.php sleep 0.5 done in the gnu / linux operating system, the implementation of the /bin/sleep program, in addition to the requirements of the posix standard , supports not only an integer argument, but also floating point numbers .
so the choice for the programmer: focus on posix- compatibility or gnu- compatibility.
In this task, one should not sleep, but check the present time with an accuracy of less than a second. A process should be constantly hanging, checking the current time with microseconds, say, in 0.02 seconds, and comparing it with the expected next “start” time. The time has come for the next half-second - the process starts the actual command to make a bet.
That waiting for the next 0.02 seconds can be trusted to sleep.
If the auction and the bot are running on different servers, it would be nice to somehow synchronize the clock with them with great accuracy - maybe by making your own implementation of the NTP similarity.
Source: https://ru.stackoverflow.com/questions/429313/
All Articles