Marcus' suggestions are great. In the past, I have also used supervisord to "daemonize" a flowgraph. If it ever dies, supervisord brings it right back if that's what you want. It's like systemd for python, kinda.
On Wed, Jul 12, 2017 at 3:30 AM Marcus Müller <marcus.muel...@ettus.com> wrote: > 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: > > 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. > > I added some basic python code to daemonize my flowgraph: > > > # 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 = top_block_cls(options) > tb.start() > time.sleep(60.0) > tb.stop() > tb.wait() > > 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. > > $ ./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 > listDiscuss-gnuradio@gnu.orghttps://lists.gnu.org/mailman/listinfo/discuss-gnuradio > > > > _______________________________________________ > Discuss-gnuradio mailing list > Discuss-gnuradio@gnu.org > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio > -- Very Respectfully, Dan CaJacob
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio