如何在ubuntu後臺運行python腳本?我試圖用「&」,例如:如何在ubuntu後臺運行python腳本?
python3 test.py &
但是當我關閉終端,這個過程似乎被關閉,以及因爲我不能得到任何更新此測試腳本的日誌。
如何在ubuntu後臺運行python腳本?我試圖用「&」,例如:如何在ubuntu後臺運行python腳本?
python3 test.py &
但是當我關閉終端,這個過程似乎被關閉,以及因爲我不能得到任何更新此測試腳本的日誌。
你可以使用setsid。在你的情況下運行:
setsid python test.py
或者,如評論中提到的,你可以使用nohup。
nohup python test.py
你可以看到這個答案它們之間的區別:What's the difference between nohup and a daemon?
謝謝,它的作品。 –
添加'nohup' http://stackoverflow.com/questions/32784462/how-to-run-multiple-php-scripts-在背景上的ubuntu – Serge
閱讀此答案[http://stackoverflow.com/questions/2975624/how-to-run-a-python-script-in-the-background-even-after-i-logout- ssh](http://stackoverflow.com/questions/2975624/how-to-run-a-python-script-in-the-background-even-after-i-logout-ssh) – Minji