Create a server using scripting


Use the commands in the ServerManagement command group for the AdminTask object or the AdminServerManagement script library to create a new appserver, Web server, proxy server, or generic server.

There are three ways to complete this task. This page uses the AdminConfig object and the commands for the AdminTask object to create a new server configuration. Alternatively, we can use the scripts in the AdminServerManagement script library to create an appserver, Web server, proxy server, or generic server.

 

  1. Launch wsadmin using Jython.

  2. Obtain the configuration ID of the node object.

    The following example obtains the configuration ID of the node and assigns it to the mynode variable:

    • Jacl...

      set node [$AdminConfig getid /Node:mynode/]

    • Jython...

      node = AdminConfig.getid('/Node:mynode/')

  3. Determine whether to use the AdminConfig or AdminTask object to create the server.

  4. Create the server.

    • The following example uses the commands for the AdminTask object to create a server:Using the AdminTask object:

      • Jacl...

        $AdminTask createApplicationServer mynode {-name test1 –templateName default}

      • Jython...

        AdminTask.createApplicationServer(mynode, ['-name', 'test1', '-templateName', 'default'])

    • The following example uses the AdminConfig object to create a server:Using the AdminConfig object:

      • Jacl...

        $AdminConfig create Server $node {{name myserv} {outputStreamRedirect {{fileName myfile.out}}}}

      • Jython...

        AdminConfig.create('Server', node, [['name', 'myserv'], ['outputStreamRedirect', [['fileName', 'myfile.out']]]])

  5. Save the configuration changes...

    AdminConfig.save()

  6. In a network deployment environment only, synchronize the node. Use the syncActiveNode or syncNode scripts in the AdminNodeManagement script library to propagate the configuration changes to node or nodes.

    • Use the syncActiveNodes script to propagate the changes to each node in the cell...

      AdminNodeManagement.syncActiveNodes()

    • Use the syncNode script to propagate the changes to a specific node, as the following example demonstrates:

      AdminNodeManagement.syncNode("myNode")

 

Related tasks


Synchronizing nodes with wsadmin
Create appservers using the admin console
Creating generic servers
Create proxy servers
Use the AdminConfig object for scripted administration

 

Related


Server configuration scripts
Server settings configuration scripts
Commands for the AdminConfig object