On Jan 9, 1:53 pm, Tom <haged...@tcnj.edu> wrote: > I'm having difficulty running Sage in the background on a Mac with OSX. > 5 and getting the output saved in a file. I tried a few permutations > with different results so I expect I'm making a silly error. Here's > what I've seen. > Since the program runs fine in some of the scenarios, I don't think > the program (which I call "commands.sage") is the problem (I've made > it simpler and simpler without any change in the results). Any help > would be appreciated. > > Thanks, > Tom > > 0. If I run Sage (from the command line) and type > > load "commands.sage" > > then the program runs fine. > > 1. If I run > > nohup ./sage < commands.sage > results.txt & > > the file results.txt will just contain the initial startup messages > from Sage, but nothing more. > > 2. If I run > ./sage < commands.sage > results.txt > > all the output is correctly written to results.txt. The only problem > is that I can't close the terminal session and let Sage run in the > background. > > 3. If I run > > ./sage < commands.sage > > I get the initial startup message, but nothing else written to screen > or any file. > > 4. If I create a file "intro.sage" with the one line > > load "commands.sage" > > and then run > > ./sage < intro.sage > > then the program runs and the output is sent to the screen. > > 5. If I run > > nohup ./sage < intro.sage > results.txt & > > the file results.txt will just contain the initial startup messages > from Sage, but nothing more.
It seems to be working for me with: nohup ./sage mytest.sage < /dev/null > results.txt & So I gave the command file as a command-line argument, instead of on standard input; and I made sure to redirect standard input from /dev/ null. I also had to avoid the name commands.sage, because that conflicts with a module Commands that's part of Sage (via IPython). Carl --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---