I have a python script which seems to be failing to continue running its while True: ... sleep()
loop
my code is at http://github.com/xdaimon/xdaimonConky
What happens is I autostart python on system boot by running...
start.sh
#! /bin/bash sleep 120 cd ${0%/*} conky -d -c ~/.conkyrc2 python profitability.py &
cd ${0%/*} brings me to the correct directory where I eventually start profitability.py
profitability.py eventually runs
while True: .... time.sleep(2000)
This works out to be about 33.3 minutes. This python script seems to run correctly as long as my screen does not lock. After a screen lock my script ceases to run, although there is still a python process.
I'm writing this to be at least somewhat portable to other linux computers and can't have disabling screen lock or keeping a terminal open for python as prerequisites :)
There is a lot that I do not understand I am sure, I'm open to many different options here. Any help is appreciated.
I ran this script in the terminal until it quit. I had a urllib error due to poor internet connection. I wrapped urllib2 piece of code in a try: except: statement, which fixed this issue. Although this may have been the cause for my script to fail I have confirmed through much testing that my script still fails if I close my terminal and lock my screen.
I have implemented the code found at a url posted below, which works awesome while I use my computer but if I decide to lock and walk away scheduled events do not happen. http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
I'm using ubuntu GNOME 13.10 with gnome 3.
nohup
? Seeman nohup
.