How do I get nohup.out flushed more often?
Solution 1:
Yeh, this is got to do with the way stdout is buffered by default on Linux. You need to explicitly run setbuf() in the code to override this behavior.
My suggestion is to avoid nohup, if you're using the bash shell, it allows you to disassociate the command from your shell
$ ( my_cmd > ~/output.log 2>&1 & )
You can also use disown
for a similar effect on a currently running job.
Solution 2:
Since your program is python, you can run it with python -u. Alternatively you might find the unbuffer program useful.