I run a python script several days ago using 'python a.py &' on my Ubuntu 12.04. I assume it's running all the time, but just now I found it crashed 2 days ago.
Is there any log information on ubuntu that I can find how it crashed? Any debug message recorded by the system?
Also, is there a way to set up a alert checking, like send me an email if this python script is not running anymore? I need it to be running all the time.
Thanks
Best Answer
In this case stderror/out will go to that file "myscriptoutput" and will not use tty. Once you close your ssh session generated HUP signal will be ignored by python process. And as of monitoring your script: put a cron job to run every 2 minutes and do something like this:
There are actually much better ways to do it of course but this is will get you started.
Hope this helps.