I wrote a python script to do this in Linux ... not to restart it if it stopped, but to notify me if it exited with an error condition. Basically, start the program with a system call from within the python script, and then catch the return value. If it's != 0, it sends me an email. If you just want to restart it if it stops, you could also moniter the /proc filesystem, either manually or with a ps call.
If you open the file twice, does it open multiple processes? If not, just schedule a task to load that file every hour or whatever, and if its already running, it won't load another, and if it isn't then it'll load it.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.