How to run a script that will work, even if there are no users on the site, to be more precise, in the future I will need to load data from one service and upload it to the database in order to use it when I launch it did not wait for it to load data for that day, I want to ensure that at a certain time of day the script on the host itself performs this operation, and the user is given data directly from the database, is it possible?
- Google about cron - Vladimir Martyanov
|
1 answer
In general, there is a crontab for this.
If hunting hardcore, then:
Write the script in an infinite loop and run from the console.
(php /path/script.php> / dev / null 2> & 1) &
Look only for leaks not to be remembered and monitor the load on the rest of the iron.
- oneWe must not forget to set the limits and timeouts, and the server itself will crash the script to exceed the limit in the value of
max_execution_timein both cases. - Alex Krass
|