Hello all, I have a python script and am wondering is there any way that I can ensure that the script run's continuously on a remote computer? Like for example, if the script crashes for whatever reason, is there a way to start it up automatically instead of having to remote desktop. Are there any other factors I have to be aware of? The script will be running on a window's machine.
+1
A:
Many ways - In the case of windows, even a simple looping batch file would probably do - just have it start the script in a loop (whenever it crashes it would return to the shell and be restarted).
Ofir
2010-06-02 12:29:48
+1 for keeping it simple
whaley
2010-06-02 12:39:44
Sounds promising. I have never written a batch file before though. Any idea of a good place to start learning?
Richard
2010-06-02 12:45:57
:TOP script.py GOTO TOP Look, it's my first batch file. Thanks for the help
Richard
2010-06-02 13:10:23
A:
Depends on what you mean by "crash". If it's just exceptions and stuff, you can catch everything and restart your process within itself. If it's more, then one possibility though is to run it as a daemon spawned from a separate python process that acts as a supervisor. I'd recommend supervisord but that's UNIX only. You can clone a subset of the functionality though.
Noufal Ibrahim
2010-06-02 12:32:14