Answer the question
In order to leave comments, you need to log in
How to determine if the execution of the console command has completed?
There is a project on Yii 2 and several console commands hung on kroner. Some run once a minute, some once every half an hour. How can I find out if this or that command has been executed and if not, then do not run it?
Answer the question
In order to leave comments, you need to log in
The easiest way is to use lock files. When run, the command creates an empty file with a specific name, and deletes it when finished. Accordingly, at startup, it checks whether such a file already exists, and if it does, it means with a high degree of probability that the previous launch is still working. Instead of a file, it is fashionable to use a database.
A more complicated way is to run tasks through a special task manager that will monitor their order, control whether the process has hung, etc.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question