問題:一個python腳本test.py,內含while True循環。想讓這個while True循環永遠在后台運行。
如果在終端直接 python test1.py & ,腳本正常運行,但是此時關閉ssh終端,腳本將會推出。
解決:
1、通過 nohup ./proc_source.py > nohup.log 2>&1 & 運行腳本。(推薦)
2、通過編寫shell啟動腳本運行python腳本
#! /bin/sh
python test123.py &
然后運行shell腳本即可。