WAS v8.5 > Script the application serving environment (wsadmin)Get started with wsadmin scripting
Scripting is a non-graphical alternative used to manage WebSphere Application Server.
The WAS wsadmin tool provides the ability to run scripts. The wsadmin tool supports a full range of product administrative activities.
Restriction: The wsadmin tool does not apply to the Liberty profile. See Administer the Liberty profile instead.
The following figure illustrates the major components involved in a wsadmin scripting solution:
Figure 1. A WAS scripting solution. This figure illustrates the major components involved in a wsadmin scripting solution.
The wsadmin tool supports two scripting languages: Jacl and Jython. Five objects are available when we use scripts:
- AdminControl: Use to run operational commands.
- AdminConfig: Use to run configurational commands to create or modify WAS configurational elements.
- AdminApp: Use to administer applications.
- AdminTask: Use to run administrative commands.
- Help: Use to obtain general help.
The scripts use these objects to communicate with MBeans that run in WAS processes. MBeans are Java objects that represent JMX resources. JMX is an optional package addition to Java 2 Platform Standard Edition (J2SE). JMX is a technology that provides a simple and standard way to manage Java objects.
Some wsadmin scripts, including the AdminApp install, AdminApp update, and some AdminTask commands, require the user ID under which the server is running must have read permission to the files created by the user that is running wsadmin scripting. For example, if the application server is running under user1, but you are running wsadmin scripting under user2, you might encounter exceptions involving a temporary directory. When user2 runs wsadmin scripting to deploy an application, a temporary directory for the enterprise application archive (EAR) file is created. However, when the application server attempts to read and unzip the EAR file as user1, the process fails. It is not recommended set the umask value of the user that is running wsadmin scripting to 022 or 023 to work around this issue. This approach makes all of the files created by the user readable by other users. To resolve this issue, consider the following approaches based on your administrative policies:
- Run wsadmin scripting with the same user ID as the user that runs the deployment manager or application server. A root user can switch the user ID to complete these actions.
- Set the group ID of the user that is running the deployment manager or application server to be the same group ID as the user that is running wsadmin scripting. Also, set the umask value of the user that is running the wsadmin scripting to be at least a umask 027 value so that files created by the wsadmin scripting can be read by members of the group.
- Run wsadmin scripting from a different machine. This approach forces files to be transferred and bypasses the file copy permission issue.
To perform a task using scripting, first perform the following steps:
- Choose a scripting language. The wsadmin tool only supports Jacl and Jython scripting languages. Jacl is the language specified by default. To use the Jython scripting language, use the -lang option or specify it in the wsadmin.properties file.
- Start the wsadmin scripting client interactively, as an individual command, in a script, or in a profile.
Before you perform any task using scripting, make sure that you are familiar with the following concepts:
- JMX
- WAS configuration model
- wsadmin tool
- Jacl syntax or Jython syntax
- Scripting objects
Optionally, we can customize your scripting environment. For more information, see Administrative properties for using wsadmin.sh.
After you become familiar with the scripting concepts, choose a scripting language, and start the scripting client, you are ready to perform tasks using scripting.
Subtopics
- What is new for scripted administration (wsadmin)
This topic highlights what is new or changed for users who are going to customize, administer, monitor, and tune production server environments using wsadmin.- New features overview for scripting the application serving environment
Use the links provided in this topic to learn about the administrative features.- Use wsadmin scripting with JMX
JMX is a framework that provides a standard way of exposing Java resources, for example, application servers, to a system management infrastructure. Using the JMX framework, a provider can implement functions, such as listing the configuration settings, and editing the settings. This framework also includes a notification layer that management applications can use to monitor events such as the startup of an application server.- WAS configuration model using wsadmin.sh
Understanding the relationship between the different configuration objects is essential when creating wsadmin scripts that perform configuration function.- Use wsadmin scripting with Jacl
Jacl is an alternate implementation of TCL, and is written entirely in Java code.- Use wsadmin scripting with Jython
Jython is an alternate implementation of Python, and is written entirely in Java.- Use the wsadmin scripting objects
The wsadmin tool utilizes a set of management objects which allow us to run commands and command parameters to configure the environment. Use the AdminConfig, AdminControl, AdminApp, AdminTask, and Help objects to perform administrative tasks.- Start the wsadmin scripting client using wsadmin.sh
We can use wsadmin to configure and administer application servers, application deployment, and server runtime operations.- What is new for scripted administration (wsadmin)
This topic highlights what is new or changed for users who are going to customize, administer, monitor, and tune production server environments using wsadmin.- New features overview for scripting the application serving environment
Use the links provided in this topic to learn about the administrative features.
Related
Use wsadmin scripting
Reference:
wsadmin scripting tool
Administrative properties for using wsadmin.sh
Scripting and command line reference material using wsadmin.sh
Related information:
IBM Jacl to Jython Conversion Assistant
WAS Administration Using Jython