I am running my Python script using upstart feature of Ubuntu so that if for whatever reason my Python script dies or gets killed, it can be restarted automatically.So I decided to use UPSTART feature of Ubuntu to restart the Python script automatically.After creating the testing.conf file like this in /etc/init/testing.conf -chdir /tekoozexec python testing.pyrespawnI ran below sudo command to start it and I can see that process running using ps ax and my python script is also running fine.root@bx13:/tekooz# sudo start testingtesting start/running, process 27794This is my below python script -#!/usr/bin/pythonimport timewhile True:    print Hello World    time.sleep(5)But how do I test it to see if my Python script gets killed, then it is getting restarted automatically? I cannot kill the PID as the PID keeps on changing if I do ps ax on my testing.py.Can anyone tell me how to test this scenario? I am just trying to make sure my script can be restarted automatically if it gets killed or dies.
How to test UPSTART feature of ubuntu to see my script gets restarted automatically if it gets killed?
linux;ubuntu;python;upstart
Just run:sudo status testingthat gives you the status of the running upstart service.And with tail -f /var/log/syslog you can see if it is respawning.The Hello World goes is I think going nowhere.I recommend testing with:#!/usr/bin/pythonimport timeimport oswith open('/var/tmp/testing.log', 'a') as fp:    try:        while True:            print >> fp, Hello World, os.getpid()            fp.flush()            time.sleep(5)    except Exception as e:        print >> fp, 'exception', e        fp.flush()        raiseand run tail -f /var/tmp/testing.log in an other window.