|
From: | Dan CaJacob |
Subject: | Re: [Discuss-gnuradio] Daemonizing a flowgraph |
Date: | Wed, 12 Jul 2017 11:09:03 +0000 |
Oh, by the way, maybe you, instead, simply would want to run your whole flowgraph using `nohup`, or simply in a `screen` or `tmux` session :)
_______________________________________________
On 07/12/2017 09:22 AM, Marcus Müller wrote:
If you can, update to the most current UHD – we've worked on the logging infrastructure, and you can simply disable that.
This will probably require building both UHD, and as soon as you've done that, GNU Radio from source.
Best regards,
Marcus
On 07/11/2017 10:39 PM, devin kelly wrote:
When I run this, it works at first (I get my prompt back, you can see me trying to open the file). But then the UHD hijacks my stdout/stderr and resumes as if nothing happened.tb = top_block_cls(options)I added some basic python code to daemonize my flowgraph:Hello,I have a flowgraph that I made with GRC and modified. All I want to do with the flowgraph is make it run as a daemon. I understand that if there are overflows or underflows I'll miss them, that's OK.
# Fork once
try:
pid = os.fork()
except OSError:
print 'error forking'
if pid > 0: # if parent, return
return
os.umask(0)
# Reset the session ID
try:
os.setsid()
except OSError:
sys.exit(1)
# Fork twice, giving up ownership of first parent's SID
try:
pid = os.fork()
except OSError:
print 'error forking'
if pid != 0: # if parent, return
sys.exit(0)
# Change PWD
try:
os.chdir('/')
except OSError:
return
# Close open files
sys.stdin.close()
sys.stdout.close()
sys.stderr.close()
with open('/dev/null', 'r+') as devnull:
sys.stdin = devnull
sys.stdout = devnull
sys.stderr = devnull
tb.start()
time.sleep(60.0)
tb.stop()
tb.wait()
$ ./flowgraph.py -t 30
linux; GNU C++ version 4.8.4; Boost_105500; UHD_003.009.005-0-g32951af2
$ vim flowgraph.py -- X300 initialization sequence...
-- Determining maximum frame size... 1472 bytes.
-- Setup basic communication...
-- Loading values from EEPROM...
-- Setup RF frontend clocking...
-- Radio 1x clock:200
-- Initialize Radio0 control...
-- Performing register loopback test... pass
-- Initialize Radio1 control...
-- Performing register loopback test... pass
How do I stop the UHD from doing this?
Thanks for any help,
Devin
_______________________________________________ Discuss-gnuradio mailing list address@hidden https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
[Prev in Thread] | Current Thread | [Next in Thread] |