-
Introduction
The wsadmin tool allow to run administrative scripts.
Scripts can be written using either Jython or JACL languages.
Scripts can be executed using:
- Interactive commands.
- Individual commands.
- Script files.
- Profile scripts.
wsadmin supports five scripting objects:
- AdminControl
- AdminConfig
- AdminApp
- AdminTask
- Help
-
Interactive commands
To execute interactive commands with wsadmin:
- Open a terminal window.
- Go to: ${WAS_PROFILE_ROOT}\bin
- Run wsadmin: wsadmin.bat -lang jython -username admin -password admin
- You don't need to supply the administrative username/password if the global security is disabled.
- Execute your commands and have fun!
- Type exit
when you are done.
Here's a snapshot of my terminal session:
-
Individual commands
To execute individual commands with wsadmin:
- Open a terminal window.
- Go to: ${WAS_PROFILE_ROOT}\bin
- Run wsadmin and supply your command:
-- On Windows: wsadmin.bat -lang jython -username admin -password admin -c "print 'Hello Individual World!'"
-- On Linux: wsadmin.sh -lang jython -username admin -password admin -c 'print "Hello Individual World!"'
- Note the use of the -c
parameter followed by the Jython command.
Here's a snapshot of my terminal session:
-
Script files
You can write Jython scripts wich you can save in a file and run the script file with wsadmin.
- First create a file that will contain the Jython script.
Here's an example (firstJythonSample.jy
):
- Save the file (in any place you want): C:\programs\jythonSamples\firstJythonSample.jy
- Run your script using wsadmin: wsadmin.bat -lang jython -username admin -password admin -f C:\programs\jythonSamples\firstJythonSample.jy
- Note the use of the -f
parameter followed by the path of the file path.
Here's a snapshot of my terminal session:
-
Profile scripts
You can use a profile script if you want a script that will be run by wsadmin before any other script files (including those that you will run as interactive or individual commands).
Typicaly a profile script can be used to run specific commands or to set global environements variables.
- First create a file that will contain the Jython profile script.
Here's an example (firstJythonProfileSample.jy
):
- Save the file (in any place you want): C:\programs\jythonSamples\firstJythonProfileSample.jy
- Run your script using wsadmin: wsadmin.bat -lang jython -username admin -password admin -profile C:\programs\jythonSamples\firstJythonProfileSample.jy -f C:\programs\jythonSamples\firstJythonSample.jy
- Note the use of the -profile
parameter followed by the path of the file path.
Here's a snapshot of my terminal session (using a profile script whith interactive commands, individual commands, and script files):
-
wsadmin properties
You can customize the wsadmin configuration by modifying the following file:
${WAS_ROOT}\properties\wsadmin.properties
Here's two properties you may need to modify: