0 Replies - 881 Views - Last Post: 12 January 2014 - 10:39 AM Rate Topic: -----

#1 xdaimon  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 12-January 14

Need help keeping python script alive

Posted 12 January 2014 - 10:39 AM

Hey guys, I've been through the ringer with this one the past few days. I wrote a script to retarget my Altcoin miner every once in a while. It builds a command string from api data grabbed at coinwarz.com on an interval, it then issues the command to the system.

Its simple but I am having trouble keeping it alive through screen locks. I am running ubuntu GNOME 13.10 with gnome 3.

here is a test script which has failed the screen lock challenge :)

https://github.com/x.../master/test.py

when I run
((python test.py)&)
, close the terminal, lock the screen, wait and unlock I see that it has not executed.

I have tried different commands to start the script as well, such as

(python test.py) &
followed by
disown


python test.py &
followed by
disown


And permutations of the above ideas using
nohup python test.py
to avoid hangup signals

In a similar approach I have also tried forking my python process via python code in order to daemonize it. This gave me independence from the terminal but after a few minutes with the screen locked the script no longer executed. The code I used is found here http://www.jejik.com...emon_in_python/

I previously had the function of timing the executions left in the hands of conky. This also did not work, I would wake up to 8 hours of run time on bfgminer. And I have tested that just now to confirm that the ${execi 60 python test.py} is not continuing.

I have also tried to import signals in python to capture SIGHUPs, but I lack any deep knowlege of unix signals and how to use that module. As far as trying to debug python, I'm not to familiar with it. It would be nice if i could just pipe whatever output the python interpreter makes to a file but I haven't spent much time on that option yet.

If I run this little test script in an open terminal, or even if I daemonize the python process and kill the terminal, it still works, only when the screen locks does everything seem to go into coma. My computer is not set to hibernate or suspend, bfgminer keeps on trucking through the lock, its just my python script doesnt want to comply :)

This is my unix stackexchange question, if you want to view it for more info. http://unix.stackexc...creen-is-locked

Does having a password protected locked screen prevent new processes from being spawned? Would bfgminer ignore SIGTERMs while screen is locked? If python has no stdout or stderr can it hang? I feel this is a gnome 3 related problem.

Anybody with superior python or unix knowledge can you help me!? It would be very appreciated.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1