Jython script library
The Jython script library provides a set of procedures to automate the most common appserver administration functions. For example, we can use the script library to configure...
- mail settings
- business-level applications
- authorization groups
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 appserver administration functions. There are three ways to use the Jython script library.
- Run scripts from the Jython script library in interactive mode with wsadmin.wsadmin>AdminServerManagement.createApplicationServer("myNode", "myServer", "default")
- Use a text editor to combine several scripts from the Jython script library...###
### My Custom Jython Script - file.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
Save the custom script and run it from the command line...bin>wsadmin -language jython -f path/to/your/jython/file.py
- Use the Jython scripting library code as sample syntax to write custom scripts.
The script library code is located in...APP_ROOT/scriptLibraries
Within this directory, the scripts are organized into subdirectories according to functionality, and further organized by version. For example, the directory...APP_ROOT/scriptLibraries/application/V70
...contains procedures that perform application management tasks that are applicable to V7.0 and later of WAS ND.
Each script from the script library directory automatically loads when you launch wsadmin.
To automatically load the own Jython scripts (*.py) when wsadmin starts, create a new subdirectory, and save existing automation scripts in the directory...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 the WAS_HOME/scriptLibraries directory when wsadmin starts, set the wsadmin.script.libraries system property to the script location. For example, if the 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: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 (;)...bin>wsadmin -lang jython -javaoption "-Dwsadmin.script.libraries=c:/myJythonScripts;c:/AdminScripts;c:/configScripts"
The script library provides automation scripts for the following appserver administration functions:
- Manage appservers.
Use the AdminServerManagement scripts to configure...
- Manage server and system architecture.
Use the AdminServerManagement, AdminNodeManagement, and AdminClusterManagement script libraries to manage clusters, nodes, and node groups.
- Manage applications.
Use the AdminApplication scripts to install, uninstall, and update the applications with various options.
- Manage data access resources.
Use the AdminJDBC and AdminJ2C script libraries to manage data sources and JDBC providers, and to create and configure J2C resource adapters.
- Manage messaging resources.
Use the AdminJMS script library to configure and manage the JMS configurations.
- Manage mail resources.
Use the AdminResources scripts in the script library to configure mail, URL, and resource settings.
- Manage authorization groups.
Use the AdminAuthorizations scripts to configure authorization groups.
- Monitor performance and troubleshoot configurations.
Use the AdminUtilities scripts to configure trace, debugging, logs, and performance monitoring.
- Get script library help using wsadmin
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.
What to do next
Determine which scripts to use to automate the environment, or create custom scripts using assembly tools.
Automating server administration
Automating admin architecture setup
Automating application configurations
Automating business-level application configurations
Automating data access resource configuration
Automating messaging resource configurations
Automating authorization group configurations
Automating resource configurations.
Displaying script library help information with wsadmin
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