I have a crontab job calling a python script and outputting a file:
python run.py &> current_date.log
now sometimes when i do
tail -f current_date.log
I see that the file is populated with exit, but in other cases the log file exists, but remains empty for a long time. I am sure that the python script prints the material immediately after its launch, and the log file - . Any ideas why it stays empty for a while?
Python , , tty, . script python -u .
-u
$ python -h ... -u : unbuffered binary stdout and stderr (also PYTHONUNBUFFERED=x) see man page for details on internal buffering relating to '-u' ...
Python ( bash) . Python . python -u, .
- ( ), flush() .
flush()