WAS v8.5 > Script the application serving environment (wsadmin) > Use the wsadmin scripting AdminConfig object for scripted administration

Change the application server configuration using wsadmin

We can use the wsadmin AdminConfig and AdminApp objects to make changes to the application server configuration.

The purpose of this article is to illustrate the relationship between the commands used to change the configuration and the files used to hold configuration data. This discussion assumes that we have a network deployment installation, but the concepts are very similar for a application server installation.

  1. Start the wsadmin scripting tool.

  2. Set a variable for creating a server:

    • Jacl:

        set n1 [$AdminConfig getid /Node:mynode/]
    • Jython:

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

  3. Create a server with the following command:

    • Jacl:

        set serv1 [$AdminConfig create Server $n1 {{name myserv}}]
    • Jython list:

        serv1 = AdminConfig.create('Server', n1, [['name', 'myserv']])
    • Jython string:

        serv1 = AdminConfig.create('Server', n1, '[[name myserv]]')

    After this command completes, some new files can be seen in a workspace used by the deployment manager server on behalf of this scripting client. A workspace is a temporary repository of configuration information that administrative clients use. Any changes made to the configuration by an administrative client are first made to this temporary workspace. For scripting, when a save command is invoked on the AdminConfig object, these changes are transferred to the real configuration repository. Workspaces are kept in the wstemp subdirectory of a WAS installation.

  4. Make a configuration change to the server with the following command:

    • Jacl:

        $AdminConfig modify $serv1 {{stateManagement {{initialState STOP}}}}
    • Jython list:

        AdminConfig.modify(serv1, [['stateManagement', [['initialState', 'STOP']]]])
    • Jython string:

        AdminConfig.modify(serv1, '[[stateManagement [[initialState STOP]]]]')

    This command changes the initial state of the new server. After this command completes, one of the files in the workspace is changed.

  5. Save the configuration changes.

    Use the following command example to save your configuration changes:

      AdminConfig.save()


Related


Use the script library to automate the application serving environment using wsadmin.sh
Use the wsadmin scripting AdminConfig object for scripted administration


Reference:

Commands for the AdminConfig object using wsadmin.sh


+

Search Tips   |   Advanced Search