nohup did not write log out even using unbuffered command

21 views Asked by At

I am using nohup to run a python script in the background. In the past, I used nohup python script.py & directly, but I found the nohup.out did not update outputs from print() timely.

I did some investigations, and found "If we use nohup, stdout is redirected to a file (nohup.out), it will be block-buffered in this case, i.e., only when the size of the output reaches a certain limit, will they be put into the destination". As suggested, I used 'nohup python -u script.py &' to unbuffered the stdout. But after using it, the nohup.out did not update at all! In the past, I can still see some updates every tenth minutes, but now, nohup.out is empty all the time.

Why would it happen? How can I fix this?

0

There are 0 answers