So, basically I use the cron job to execute the php script, which takes quite a lot of time to execute (pulling the updated xml from ftp, unpacking, mysql manipulation, api access, etc.). The problem is that we are working on a server that limits the cron job execution time to 15 minutes.
My question is this: what methods can be used to eliminate this limitation? Breaking the script to pieces will still cause the pieces to work for a 15-minute period, so it will. Are there any ways to redirect to another PHP script after execution for a certain time? Or is it possible to somehow use a bash script to restart the script before reaching the 15 minute deadline?
Thank!
My first tip is to find a new host, but it seems like this is not an option for you right now.
You can track the runtime and save your status in a DB or flat file just before you press the 15 minute deadline. The next round in cron would then look at the database or file and know where to get where you left off.
It depends on what your script does, of course. If you just perform the same task for the X number of records, it sounds as if you can implement something like this.
, , . exec() script - , .
exec()
"" a script. , .
, ? 15 , cron ? , -, . 15 , . , , 15 .
, , , cron, cron wget script .
cron script. -
0 0 * * * php /path/to/file.php &
, cron, , script cron
Source: https://habr.com/ru/post/1790262/More articles:Should I continue to check if the XMLHttpRequest object exists? - javascriptПомогите мне отсортировать этот php-массив, используя usort() - sortingPassing data through higher-order functions - haskellCommon security holes specific to Rails? - securityBase class and derived class in package - javaStrange SocketExceptions: reset connection and connection timeout - javaAre there any security issues when exposing system.dll through a web service? - compiler-constructionParsing an HTTP request string in Java - javaLoad code in HTML using jQuery? - jqueryStateful Web Service Protection - javaAll Articles