I have a PHP cronjob which runs at 6:00am every day to do some calculations and store them in the SQL. What happens now is that the site becomes a bit unresponsive for about 40 seconds while the cron is running.
I was wondering whether using sleep()
in the script would do the trick? Let's say I'd pause it for 2 seconds roughly every second. Therefore, the script would run for a lot longer time, but would also let apache use the system's resources.
Am I right? Does it work? Or will the script still keep resources to itself, even during the sleep()
?