当前位置:主页 > 软件编程 > Python代码 >

nohup后台启动Python脚本,log不刷新的解决方法

时间:2021-08-11 08:24:21 | 栏目:Python代码 | 点击:

问题:

=》nohup python3 xxxx.py &后台启动脚本

tail -100f nohup.out    -------->     无显示

原因:

python的输出有缓冲,导致日志文件并不能够马上看到输出。

-u参数,使得python不启用缓冲。

方法:

所以修改命令即可:

nohup python3 -u xxxx.py > nohup.out &

您可能感兴趣的文章:

相关文章