0

I have python script

test.py

When I run in my Linux via command panel it shows the log (what script is doing)

python test.py

But when I run it in this way I cannot see the log file until the script is done:

nohup python test.py 1> logifle.log 2>&1 &

How I can see the log inside the logfile.log during the script is working?

1 Answers1

0

Use -u flag; from python --help:

-u     : force the stdout and stderr streams to be unbuffered;
         this option has no effect on stdin; also PYTHONUNBUFFERED=x

Need to do this:

nohup python -u test.py 1> logifle.log 2>&1 &