Network Deployment (Distributed operating systems), v8.0 > Scripting the application serving environment (wsadmin)
Use the script library with wsadmin.sh
Overview
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, you can use the script library to 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 quickly develop new scripts.
Run scripts interactively
wsadmin>AdminServerManagement.createApplicationServer("myNode", "myServer", "default")
Execute a script
For example, ...
### newsite.py
###
### 1. Create two appservers
### 2. Use one of them as the first member of a cluster
### 3. Add a second member to the cluster
### 4. Install an application
### 5. Start all servers and applications on the node
###
### Usage:
###
### wsadmin.sh -language jython -f /path/to/newsite.py -user wpadmin -password foo
###
AdminServerManagement.createApplicationServer("myNode", "WebSphere_Portal", "default")
AdminServerManagement.createApplicationServer("myNode", "WebSphere_Portal_2", "default")
AdminClusterManagement.createClusterWithFirstMember("myCluster", "APPLICATION_SERVER", "myNode", "WebSphere_Portal")
AdminClusterManagement.createClusterMember("myCluster", "myNode", "Server3")
AdminApplication.installAppWithClusterOption("DefaultApplication", "..\installableApps\DefaultApplication.ear", "myCluster")
AdminServerManagement.startAllServers("myNode")
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...
WAS_HOME/scriptLibrariesWithin this directory, the scripts are organized into subdirectories according to functionality, and further organized by version. For example...
WAS_HOME/scriptLibraries/application/V70...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 you launch wsadmin.sh.
To load Jython scripts (*.py) when wsadmin.sh starts, create a new subdirectory, and save existing automation scripts in...
WAS_HOME/scriptLibraries
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...
WAS_HOME/scriptLibraries
...set the property...
wsadmin.script.libraries
...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 the wsadmin command line tool:
./wsadmin.sh -lang jython -javaoption "-Dwsadmin.script.libraries=c:/myJythonScripts"
To load multiple directories, specify each directory in the system property separated by a semicolon (;):
./wsadmin.sh -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:
Procedures
- Manage application servers
- Manage server and system architecture
- Manage applications
- Manage data access resources
- Manage messaging resources
- Manage mail resources
- Manage authorization groups
- Get script library help
Related
Automate server administration
Automate administrative architecture setup library
Automate application configurations
Automate business-level application configurations
Automate data access resource configuration
Automate messaging resource configurations
Automate authorization group configurations
Automate resource configurations
Display script library help information using scripting
Server settings configuration scripts
Server configuration scripts
Server query scripts
Server administration scripts
Cluster configuration scripts
Cluster query scripts
Cluster administration scripts
Node administration scripts
Node group configuration 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