參考:https://blog.csdn.net/zj360202/article/details/78894512
nohup python test.py &
nohup python test.py 2>&1 &
nohup python test.py > test.out 2>&1 &
上面三種方式無論在nohup.out 或test.out都看不到數據結果,這是因為python執行有緩存輸出。
解決:使用-u參數
nohup python -u test.py > test.out 2>&1 &