unix crontab不能很好地处理python的subprocess.popen

yuv*_*shu 5 python unix crontab python-2.6

我正在使用crontab启动一个python脚本,假设使用subprocess.popen()自行启动几个procceses.我使用此命令启动可能需要30分钟的过程 - 所以我不想等待结果,而是继续使用我原来的crontab运行脚本.问题是crontab似乎像subprocess.call一样处理subprocess.popen!

我可以在我的日志文件和进程列表中清楚地看到第一个popen成功但它不会在后台继续 - 它等到firts popen进程结束...

这可能是因为我将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..
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

jco*_*ado 1

我不确定这与问题有关,但是当重定向到您应该使用stderr的相同管道时,请按照文档中的说明进行使用。stdoutstderr=subprocess.STDOUT