Why and when to perform this task
You can run scripting commands in several different ways. The command for invoking a scripting process is located in the WebSphere/AppServer/bin directory or the WebSphere/DeploymentManager/bin directory. To invoke a scripting process, use the wsadmin.bat file for a Windows system, and the wsadmin.sh file for a UNIX system.
To specify the method for executing scripts, perform one of the following wsadmin tool options:
Execute wsadmin with an option other than -f or -c.
Note: On a Unix operating system, if you use the wsadmin -c option to invoke a command that includes a dollar sign character ($), the command line attempts to substitute a variable. To avoid this problem, escape the dollar sign character with a backslash character (\). For example: wsadmin -c "\$AdminApp install ...".
An interactive shell appears with a
wsadmin prompt. From the wsadmin prompt, enter any JACL command. You can also
invoke commands on the AdminControl, AdminApp, AdminConfig, or Help wsadmin
objects. The following example is a command invocation and sample output on
Windows systems:
Using Jacl:
wsadmin.batExample output:
WASX7209I: Connected to process server1 on node myhost using SOAP connector; The type of process is: UnManagedProcess WASX7029I: For help, enter: "$Help help" wsadmin>$AdminApp list adminconsole DefaultApplication ivtApp wsadmin>exit
To leave an interactive scripting session, use the quit or exit commands. These commands do not take any arguments.
Execute wsadmin with the -c option.
For example, on Windows systems:
Using Jacl:
wsadmin -c "$AdminApp list"
For example, on UNIX systems:
wsadmin.sh -c "\$AdminApp list"or
wsadmin.sh -c '$AdminApp list'
Example output:
WASX7209I: Connected to process "server1" on node myhost using SOAP connector; The type of process is: UnManagedProcess adminconsole DefaultApplication ivtApp
Execute wsadmin with the -f option, and place the commands you want to execute into the file.
The following examples show how to run scripting commands in a script:
Using Jacl:
wsadmin -f al.jaclwhere the al.jacl file contains the following commands:
set apps [$AdminApp list] puts $apps
where the al.py file contains the following commands:
apps = AdminApp.list() print apps
Example output:
WASX7209I: Connected to process "server1" on node myhost using SOAP connector; The type of process is: UnManagedProcess adminconsole DefaultApplication ivtApp
A profile is a script that runs before the main script, or before entering interactive mode. You can use profiles to set up a scripting environment customized for the user or the installation.
To run scripting commands in a profile, execute the wsadmin tool with the -profile option, and place the commands you want to execute into the profile. For example:
Using Jacl:
wsadmin.bat -profile alprof.jaclwhere the alprof.jacl file contains the following commands:
set apps [$AdminApp list] puts "Applications currently installed:\n$apps"
Example output:
WASX7209I: Connected to process "server1" on node myhost using SOAP connector; The type of process is: UnManagedProcess Applications currently installed: adminconsole DefaultApplication ivtApp WASX7029I: For help, enter: "$Help help" wsadmin>
What to do next
To customize the script environment, specify one or more profiles to run.