WebSphere Application Server & Liberty

WebSphere Application Server & Liberty

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Jython Script to Create Server

    Posted 11/10/12 12:53 AM
    websphere-automation.blogspot.com/2012/1...

    Jython Script to create Server



    JYTHON SCRIPT TO CREATE SERVER

    Copy the Below Code and create a file create_server.py and place the file in Deployment Manager Bin Directory  :-
    #-------------------------------------------#
    import sys,java
    from java.util import Properties
    from java.io import FileInputStream
    from org.python.modules import time
    lineSep = java.lang.System.getProperty('line.separator')

    def server_create(node,server):
     node=AdminConfig.getid('/Node:'+node+'/')
     attr=[['name', server]]
     print "creating server .."
     AdminConfig.create('Server',node,attr)
     print "server created .."
     AdminConfig.save()
     print "saving config .."


    arglen=len(sys.argv)
    number_of_argument=2
    if ( arglen != number_of_argument):
     print "pass 2 arguments .."
     sys.exit(-1)

    server=sys.argv[0]
    node=sys.argv[1]
    server_create(node,server)


    #----------------------------------------#

    Execute the script using below wsadmin command
    Windows:
    Go to DMGR BIN directory

     wsadmin.bat -f create_server.py -lang jython -port -conntype SOAP -user -password  

    Unix :-
    Go to DMGR BIN directory


     ./wsadmin.sh -f create_server.py -lang jython -port -conntype SOAP -user -password  

    Example :
     ./wsadmin.sh -f create_server.py -lang jython -port 8879 -conntype SOAP -user wasadmin -password wasadmin test_server test_node


  • 2.  Jython Script to Create Server

    Posted 11/12/12 12:45 PM
    Just a suggession:

    Please post all the scripts as 'blog posts' not in forum and keep a series name , something like
    'websphere automation scripts - createJVM'