Answer the question
In order to leave comments, you need to log in
How to manage background rake tasks from the admin panel?
I can't figure it out. I made some rake tasks that should run in the background as zombie processes. Those. do not run on a schedule, but work constantly.
I want to see the status of these processes in the web interface (in my admin panel), and, if necessary, stop the process or start it. How to implement it correctly?
I would be grateful for a detailed answer.
Answer the question
In order to leave comments, you need to log in
I have never done this, but theoretically it is possible like this: each process creates a process.pid file in which it puts its pid, then in the admin panel code we look inside each such file and then look for a process with such a pid, if the process has a service running, if not, not works
The solution in the forehead is to make a new entity, such as RakeTaskManager Run
and cut off tasks from the admin panel. When launched, the active status is written to the database. when turned off - inactive.
You can write the process ID to the database, and then let the process manager figure it out.
Maybe there are better solutions, but then the conditions need to be more specific .
PS
In general, look towards God, Monit. There might be something for you. Perhaps there are ready-made solutions with a web interface.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question