Created
September 18, 2014 11:40
-
-
Save DemkaAge/78c2e17e9623246e1efd to your computer and use it in GitHub Desktop.
Start WebSpehre application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def startApplicationOnSingleServer(cellName, nodeName, serverName, appName): | |
print "---------------------------------------------------------------" | |
print " AdminApplication: Start an application on a single server " | |
print " Application name: " + appName | |
print " Node name: " + nodeName | |
print " Server name: " + serverName | |
print " Cell name: " + cellName | |
print "---------------------------------------------------------------" | |
print " Query server for app status." | |
# Query server | |
result = AdminApp.isAppReady(appName) | |
counter = 0 | |
while (result == "false"): | |
counter = counter +1 | |
#TimeOut | |
if counter >=20: | |
print " TimeOut. App not ready. Please run manual." | |
return -1 | |
### Wait 5 seconds before checking again | |
time.sleep(5) | |
result = AdminApp.isAppReady(appName) | |
print " Try count " + str(counter) | |
print " Application is ready." | |
# Query application MBean on specific process | |
runningApp = AdminControl.queryNames("type=Application,name="+appName+",cell="+cellName+",node="+nodeName+",process="+serverName+",*") | |
if(len(runningApp) <= 0): | |
print " Starting application..." | |
# Query application manager mbean | |
appManager = AdminControl.queryNames( | |
"cell=" + cellName + ",node=" + nodeName + ",type=ApplicationManager,process=" + serverName + ",*") | |
AdminControl.invoke(appManager, "startApplication", appName) | |
return 1 # succeed | |
#endDef |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment