How to monitor multiple processes and start new one if one is exited?

214 Views Asked by At

I want to run a python script as a daemon with some arguments as different processes and monitor them continuously. If any of them exits, whether gracefully or with error, I want to start new process using new arguments.

I thought to use pm2 and its nodejs api for this, but I couldn't find any useful information on how to use pm2 api to monitor process messages.

Any ideas how to accomplish it?

1

There are 1 best solutions below

0
aadlani On

You can achieve this with Supervisor, which is a Process Control System that offers an extensive range of options for you to describe the expected behavior.