我正在编写一个脚本来自动安装和配置tcServer。在安装之后,我使用check\u output函数来启动tcServer实例,但是它挂起了。如果我检查tcServer日志,实例成功启动,没有问题。但剧本到此为止,什么也不做。
不过,如果我用popen执行相同的代码,它会运行得很顺利。
这是带有check\u输出的代码:
dirInst = '/opt/pivotal/pivotal-tc-server-standard/' + instanceName
subprocess.check_output(dirInst + '/bin/tcruntime-ctl.sh start', shell=True)
这是popen的代码:
arguments = dirInst + '/bin/tcruntime-ctl.sh start'
subprocess.Popen([arguments], stdout=subprocess.PIPE, shell=True)
time.sleep(10)
我知道shell=True是一个漏洞,但我只是想在测试过程中节省时间。
我需要使用sleep(10)来给一些时间来启动实例。
你知道吗?你知道吗
谢谢
目前没有回答
相关问题 更多 >
编程相关推荐