Good afternoon, we want to run a script that randomly throughout the day will run various functions.

Execution will be assigned randomly in time from 0 to 24 hours pending. those. before running the script will be the command:

sleep(rand(0, 60*60*24)); // секунды*минуты*часы 

because There will be a lot of teams to perform, thinking about efficiency.

Tell me whether it is effective to use the sleep command or is there a function that uses less resources?

is it possible to randomly call via cron?

  • one
  • I tried php -r 'sleep(100);' - in the top silence, the CPU does not eat. - Ivan Bolnikh
  • Thanks, but the question is not to run the script in the crown at the same time, but how to make it run efficiently through the cron at any time during the day - Maxim147
  • "I tried php -r 'sleep (100);' - in the top silence, the CPU does not eat "- how many processes are launched in parallel? more than a hundred? - Maxim147
  • So the same rand to run or not the script on the crown - Vadim

0