Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've been through the ringer with this one the past few days. I wrote a script to re-target 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/xdaimon/xdaimonConky/blob/master/test.py

I have tried different commands to start the script such as

(python test.py) & followed by disown

python test.py & followed by disown

nohup python test.py & to avoid hangup signals, or try to.

(nohup python test.py) &

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.

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 and capture SIGHUPs, but I lack any deep knowledge of *nix 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 doesn't want to comply :)

These are links to where I have posted around the web already, if you want to view them for more info. https://teksyndicate.com/forum/code/need-help-keeping-python-script-alive/167841

Does having a password protected locked screen prevent new processes from being spawned? Would bfgminer ignore SIGTERMs while screen is locked? I feel this is a gnome 3 related issue. Although, I assume there is probably some way that this type of process should usually be handled in python that I am not aware of.

Anybody with superior python or unix knowledge can you help me!? It would be very appreciated. Thanks to anybody who have already provided some feedback!

share|improve this question
If anybody is going to think about this. Read this, I had alot of interaction with another person on this question. The information may be useful. reddit.com/r/learnpython/comments/1v1rng/… It seems to be a gdm thing, whether a bug or not. –  Bradley Bauer Jan 13 at 4:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.