nohup python xxx.py > nohup.log 2>&1 &
程序將於后台運行。
nohup /opt/work/web/xenwebsite/xenwebsite-env/bin/python2.7 > nohup.log 2>&1 runserver.py & nohup : 后台運行 /opt/work/web/xenwebsite/xenwebsite-env/bin/python2.7 : python環境 > nohup.log 2>&1 : 錯誤日志寫入 nohup.log runserver.py & : 運行runserver.py 文件 運行成功他會返回進程id 可以根據進程id關掉這個文件 ps -ef | grep 進程id : 查找這個進程 kill -9 進程id : 殺掉這個進程