WAS v8.5 > Script the application serving environment (wsadmin)Use the script library to automate the application serving environment using wsadmin.sh
The script library provides Jython script procedures to assist in automating the environment. Use the sample scripts to manage applications, resources, servers, nodes, and clusters. We can also use the script procedures as examples to learn the Jython syntax.
The Jython script library provides a set of procedures to automate the most common application server administration functions. For example, we can use the script library to are configure servers, applications, mail settings, resources, nodes, business-level applications, clusters, authorization groups, and more. We can run each script procedure individually, or combine several procedures to develop new scripts.
The scripting library provides a set of procedures to automate the most common application server administration functions. There are three ways to use the Jython script library.
- Run scripts from the Jython script library in interactive mode with wsadmin. We can launch wsadmin, and run individual scripts that are included in the script library using the following syntax:
wsadmin>AdminServerManagement.createApplicationServer("myNode", "myServer", "default")
- Use a text editor to combine several scripts from the Jython script library, as the following sample displays:
# # myscript.py # AdminServerManagement.createApplicationServer("myNode", "Server1", "default") AdminServerManagement.createApplicationServer("myNode", "Server2", "default") # Use one of them as the first member of a cluster AdminClusterManagement.createClusterWithFirstMember("myCluster", "APPLICATION_SERVER", "myNode", "Server1") # Add a second member to the cluster AdminClusterManagement.createClusterMember("myCluster", "myNode", "Server3") # Install an application AdminApplication.installAppWithClusterOption("DefaultApplication", "..\installableApps\DefaultApplication.ear", "myCluster") # Start all servers and applications on the node AdminServerManagement.startAllServers("myNode")Save the custom script and run it from the command line, as the following syntax demonstrates:bin>wsadmin -language jython -f path/to/your/jython/file.py
- Use the Jython scripting library code as sample syntax to write custom scripts. Each script example in the script library demonstrates best practices for writing wsadmin scripts. The script library code is located in the app_server_root/scriptLibraries directory. Within this directory, the scripts are organized into subdirectories according to functionality, and further organized by version. For example, the app_server_root/scriptLibraries/application/V70 subdirectory contains procedures that perform application management tasks that are applicable to v7.0 and later of the product.
Each script from the script library directory automatically loads when we launch wsadmin. To automatically load our own Jython scripts (*.py) when wsadmin starts, create a new subdirectory, and save existing automation scripts in the app_server_root/scriptLibraries directory. Each script library name must be unique and cannot be duplicated.
Do not edit the script procedures in the script library. To customize script library procedures, save the modified scripts to a new subdirectory to avoid overwriting the library.
To automatically load Jython scripts (*.py) that are not located in the app_server_root/scriptLibraries directory when wsadmin starts, set the wsadmin.script.libraries system property to the script location. For example, if your script libraries are saved in the temp directory on a Windows operating system, the following example sets the script path in wsadmin line tool:
bin>wsadmin -lang jython -javaoption "-Dwsadmin.script.libraries=c:/myJythonScripts"
To load multiple directories, specify each directory in the system property separated by a semicolon (;), as the following example demonstrates:
bin>wsadmin -lang jython -javaoption "-Dwsadmin.script.libraries=c:/myJythonScripts;c:/AdminScripts;c:/configScripts"
The script library provides automation scripts for the following application server administration functions:
- Manage application servers.
We can use the AdminServerManagement scripts to configure classloaders, JVM settings, Enterprise JavaBeans containers, performance monitoring, dynamic cache, and so on.- Manage server and system architecture.
We can use the AdminServerManagement script library to manage server settings.- Manage applications.
We can use the AdminApplication scripts to install, uninstall, and update the applications with various options.- Manage data access resources.
We can use the AdminJDBC and AdminJ2C script libraries to manage data sources and JDBC providers, and to create and configure Java 2 Connector (J2C) resource adapters.- Manage messaging resources.
We can use the AdminJMS script library to manage your Java Messaging Service (JMS) configurations.- Manage mail resources.
We can use the AdminResources scripts in the script library to configure mail, URL, and resource settings.- Manage authorization groups.
We can use the AdminAuthorizations scripts to configure authorization groups.- Monitor performance and troubleshoot configurations. We can use the AdminUtilities scripts to configure trace, debugging, logs, and performance monitoring. See the Utility scripts topic.
- Get script library help using wsadmin
We can use the AdminLibHelp script library to list each available script library, display information for specific script libraries, and to display information for specific script procedures.
Determine which scripts to use to automate the environment, or create custom scripts using assembly tools.
Subtopics
- Automating server administration using wsadmin.sh
The scripting library provides Jython script procedures to assist in automating the environment. Use the server management scripts to configure servers, the server runtime environment, Web containers, performance monitoring, and logs. We can also use the scripts to administer your servers.- Automating administrative architecture setup using wsadmin.sh library
The scripting library provides Jython script procedures to assist in automating the environment. Use the server, node, and cluster management scripts to configure servers, nodes, node groups, and clusters in the application server environment.- Automating application configuration
The scripting library provides Jython script procedures to assist in automating the environment. Use the application management scripts to install, uninstall, export, start, stop, and manage applications in the environment.- Automating business-level application configuration
The scripting library provides Jython script procedures to assist in automating the environment. Use the application management scripts to install, uninstall, export, start, stop, and manage business-level applications in the environment.- Automating data access resource configuration using wsadmin.sh
The scripting library provides Jython script procedures to assist in automating the environment. Use the resource management scripts to manage your Java Database Connectivity (JDBC) configurations.- Automating messaging resource configuration
The scripting library provides Jython script procedures to assist in automating the environment. Use the resource management scripts to manage your Java Messaging Service (JMS) configurations.- Automating authorization group configuration
The scripting library provides Jython script procedures to assist in automating the environment. Use the authorization groups scripts create, configure, remove and query your authorization group configuration.- Automating resource configuration
The scripting library provides Jython script procedures to assist in automating the environment. Use the scripts in the AdminResources script library to configure mail, URL, and resource settings.- Display script library help information using scripting
The script library provides Jython script procedures to assist in automating the environment. The script library includes help commands to list each available script library, display information for specific script libraries, and to display information for specific script procedures.- Automating server administration using wsadmin.sh
The scripting library provides Jython script procedures to assist in automating the environment. Use the server management scripts to configure servers, the server runtime environment, Web containers, performance monitoring, and logs. We can also use the scripts to administer your servers.- Automating administrative architecture setup using wsadmin.sh library
The scripting library provides Jython script procedures to assist in automating the environment. Use the server, node, and cluster management scripts to configure servers, nodes, node groups, and clusters in the application server environment.- Automating application configuration
The scripting library provides Jython script procedures to assist in automating the environment. Use the application management scripts to install, uninstall, export, start, stop, and manage applications in the environment.- Automating business-level application configuration
The scripting library provides Jython script procedures to assist in automating the environment. Use the application management scripts to install, uninstall, export, start, stop, and manage business-level applications in the environment.- Automating data access resource configuration using wsadmin.sh
The scripting library provides Jython script procedures to assist in automating the environment. Use the resource management scripts to manage your Java Database Connectivity (JDBC) configurations.- Automating messaging resource configuration
The scripting library provides Jython script procedures to assist in automating the environment. Use the resource management scripts to manage your Java Messaging Service (JMS) configurations.- Automating authorization group configuration
The scripting library provides Jython script procedures to assist in automating the environment. Use the authorization groups scripts create, configure, remove and query your authorization group configuration.- Automating resource configuration
The scripting library provides Jython script procedures to assist in automating the environment. Use the scripts in the AdminResources script library to configure mail, URL, and resource settings.- Display script library help information using scripting
The script library provides Jython script procedures to assist in automating the environment. The script library includes help commands to list each available script library, display information for specific script libraries, and to display information for specific script procedures.- Saving changes to the script library
The script library provides Jython script procedures to assist in automating the environment. We can save changes to the master configuration repository, disable the automatic saving of configuration changes, or discard configuration changes.- Directory conventions
References in product information to app_server_root, profile_root, and other directories imply specific default directory locations. This article describes the conventions in use for WAS.
Reference:
Server settings configuration scripts
Server configuration scripts
Server query scripts
Server administration scripts
Application installation and uninstallation scripts
Application query scripts
Application update scripts
Application export scripts
Application deployment configuration scripts
Application administration scripts
J2C query scripts
J2C configuration scripts
JMS configuration scripts
JMS query scripts
JDBC configuration scripts
JDBC query scripts
Resource configuration scripts
Authorization group configuration scripts
Business-level application configuration scripts
Utility scripts