I have a python script that I run everyday at 00:00 as a cronjob & its lasts for about 5-6 hours. I want supervisor to monitor the script & restart if it hangs/crashes in the middle.

I have done something like this:

command=python run.py

This works but the only problem is it tries to restart the even after the completion of the script. What should do to check if the script has completed execution or crashed in the middle. I want supervisor to run only if it crashed.

Is there anything I can do in python script that signals supervisor that it has completed execution, so, supervisor don't have to restart it again?

Thanks for any help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.