0

I am using runnit to run a python process on ubuntu. I redirect the output of the program to a log file.

exec /usr/bin/python /home/ubuntu/workspace/monitor.py >> /tmp/monitor.out 2>&1

I then use

tail -f /tmp/monitor.out

to have a look at what is going on.

Howerver, it output is not streaming. Always behind, some times by a few minutes. Its not a lot of output.

How do I get realtime streaming?

Tampa
  • 75,446
  • 119
  • 278
  • 425
  • This sounds like an issue with redirected output being buffered. Maybe one of these links would be helpful? http://stackoverflow.com/questions/2753350 http://stackoverflow.com/questions/2055918 – ashastral Jul 24 '12 at 17:08
  • Glad I could help. I'll post that as an answer since it seems to be correct. – ashastral Jul 24 '12 at 17:31

1 Answers1

1

The output is probably being buffered. Put sys.stdout.flush() somewhere at the end of the script's loop to write the buffer to disk immediately. (See here for more information)

Community
  • 1
  • 1
ashastral
  • 2,818
  • 1
  • 21
  • 32