Friday, January 8, 2010

running scripts from an open wsadmin session

I would like to execute individual scripts from my local library, but rather than executing each individual script with the WebSphere overhead (i.e.wsadmin -f myscript.py).

The test file test.py

def main(args):
print AdminControl.queryNames('*')
print args
#enddef
# main method
main()



Next running the test script from an open session

$ wsadmin -port 8081 -host myhost -username memyselfandi
WASX7209I: Connected to process "WasPAdmgr" on node wasdpAdmrNode using SOAP connector; The type of process is: DeploymentManager
WASX8011W: AdminTask object is not available.
WASX7031I: For help, enter: "print Help.help()"
wsadmin>execfile('test.py')



# # This script can be included in the wsadmin command invocation like this:
# # wsadmin -lang jython -f test.py serverX nodeY c:/applicationZ myapp
# #
# # or the script can be execfiled from the wsadmin command line like this:
# # wsadmin> execfile ("test.py") or execfile("test.py")
# # wsadmin> test("serverX", "nodeY", "c:/applicationZ", "myapp")