Network Deployment (Distributed operating systems), v8.0 > Scripting the application serving environment (wsadmin) > Use the script library to automate the application serving environment using wsadmin.sh
Automate server administration using 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 interactively
wsadmin>AdminServerManagement.createApplicationServer("myNode", "myServer", "default")
Run using a script
For example, ...
### newsite.py
###
### Usage:
###
### wsadmin.sh -language jython -f /path/to/newsite.py -user wpadmin -password foo
###
### 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
###
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")
### Check if cluster exists
AdminClusterManagement.checkIfClusterExists()
### Return list of available servers
AdminServerManagement.listServers()
### Connect to the application server
./wsadmin.sh -lang jython -c "AdminServerManagement.configureAdminService("myNode", "myServer", "IPC", "JSR160RMI")
### Configure the JVM
wsadmin.sh -lang jython -c "AdminServerManagement.configureJavaVirtualMachine("myNode", "myServer", "true", "mydebug", [["internalClassAccessMode", "RESTRICT"], ["disableJIT", "false"], ["verboseModeJNI", "false"]])"
### Synchronize the node
./wsadmin.sh -lang jython -c "AdminNodeManagement.syncNode("myNode")"To enable failonerror, specify true as the last argument. For example...
AdminApplication.startApplicationOnCluster("myApplication","myCluster","true")
Save any custom scripts to...
WAS_HOME/scriptLibraries/myscripts
Related
Server settings configuration scripts
Server configuration scripts
Server query scripts
Server administration scripts
Use the script library to automate the application serving environment using wsadmin.sh
Node administration scripts
Cluster configuration scripts