我用python编写了一个脚本来启动服务器。 在循环中,我检查它们的状态,以确保所有服务器都已启动,然后再继续。你知道吗
但不知何故,在所有条件都满足之前,循环就退出了。你知道吗
你知道为什么会这样吗?你知道吗
#check if all servers are RUNNING
while (osb2State!='RUNNING') and (osb3State!='RUNNING') and (osb4State!='RUNNING') and (osb5State!='RUNNING') and (osb6State!='RUNNING') :
cd('domainRuntime:/ServerLifeCycleRuntimes/'+sOSB2);
osb2State = cmo.getState();
if osb2State == 'ADMIN':
resume(sOSB2);
cd('domainRuntime:/ServerLifeCycleRuntimes/'+sOSB3);
osb3State = cmo.getState();
if osb3State == 'ADMIN':
resume(sOSB3);
cd('domainRuntime:/ServerLifeCycleRuntimes/'+sOSB4);
osb4State = cmo.getState();
if osb4State == 'ADMIN':
resume(sOSB4);
cd('domainRuntime:/ServerLifeCycleRuntimes/'+sOSB5);
osb5State = cmo.getState();
if osb5State == 'ADMIN':
resume(sOSB5);
cd('domainRuntime:/ServerLifeCycleRuntimes/'+sOSB6);
osb6State = cmo.getState();
if osb6State == 'ADMIN':
resume(sOSB6);
java.lang.Thread.sleep(5000);
首先,这是Jython而不是python。你知道吗
第二,看看:
只有当无的状态=='运行'时,条件才为真。因此,任何处于运行状态的服务器都会导致循环退出。如果您想在退出之前启动所有服务器,请使用
or
而不是and
。你知道吗相关问题 更多 >
编程相关推荐