5
我使用crontab來啓動一個python腳本,該腳本假設使用subprocess.popen()自行啓動多個procceses。我使用這個命令來啓動一個可能需要30分鐘的過程 - 所以我不想等待結果,而是繼續使用我原來的crontab運行腳本。事情是,crontab似乎處理subprocess.popen像subprocess.call!unix crontab不處理python的subprocess.popen以及
我可以清楚地看到我的日誌文件和第一POPEN成功的進程列表,但它並不在後臺繼續合 - 它等待,直到POPEN過程結束firts ...
難道這是因爲我重定向stderr/steout到文件?我沒有看到連接,但也許......
我的代碼如下:
# inside process spawning loop
# open and append process to list
mainLogger.debug("about to launch process with popen")
scoopPopenObj = subprocess.Popen(cmdArgsString,
shell=True,stdout=qScoopLogFile,stderr=qScoopLogFile)
openScoops.append((fileName,time.time(),scoopPopenObj))
# rest of script, here is where i dont get until scoopPopenObj finishes..
什麼想法?