0

I am in the process of creating a Python program (lets call it Program1), which will terminate randomly. I need another program to check if Program1 has been terminated, and if so, to restart it after a given amount of time. Should I use another Python program to do this, or is there a way this can be done in Windows e.g. similar to a cron job?

From what I understand, you can use sys.exit(), exit() and quit() to kill a Python program, but do all of these also kill all other running Python programs?

Thanks

1
  • 1
    do all of these also kill all other running Python programs? they all do not Commented May 8, 2014 at 21:45

1 Answer 1

1

Reliably determining whether a specific program is still running or not can be done in multiple ways.

A good way to do so would be using a specific lock file. You can find how to do this in Python described in this thread.

To answer the second part of your question: sys.exit(), exit() and others will only stop the currently running Python process, not any others that might be running concurrently.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.