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/V5R0M0/AppServer/bin directory or the /WebSphere/V5R0M0/DeploymentManager/bindirectory. To invoke a scripting process, use the wsadmin.sh file.
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.
Using Jacl:
wsadmin.sh -user wsadmin -password wsadminExample 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.
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.
Note: WebSphere Application Server for z/OS supports multiple encoding for the Jacl command files. The default encoding for the command file is ASCII. To run an EBCDIC encoded file, pass the following Java virtual machine (JVM) argument to the wsadmin.sh file via the -javaoption flag:
-Dscript.encoding=Cp1047
For example:
wsadmin.sh -javaoption -Dscript.encoding
You can alternatively have two versions of the wsadmin.sh file, one that references the ASCII version of the jacl file and another that references the EBCDIC version of the jacl file. For example, copy the wsadmin.sh file to wsadminE.sh. Then add
-Dscript.encoding=Cp1047to the wsadminE.sh file.
The following examples show how to run scripting commands in a script:
Using Jacl:
wsadmin.sh -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.
Note: WebSphere Application Server for z/OS supports multiple encoding for Jacl profile scripts. The default encoding for the profile file is ASCII. To run an EBCDIC encoded profile script file, pass the following Java virtual machine (JVM) argument to the wsadmin.sh file via the -javaoption flag:
-Dprofile.encoding=Cp1047
For example:
wsadmin.sh -javaoption -Dprofile.encoding
You can alternatively have two versions of the wsadmin.sh file, one that references the ASCII version of the jacl file and another that references the EBCDIC version of the jacl file. For example, copy the wsadmin.sh file to wsadminE.sh. Then add
-Dprofile.encoding=Cp1047to the wsadminE.sh file.By default, the following profile files might be configured for the com.ibm.ws.scripting.profiles profiles property in the install_root/properties/wsadmin.properties file:
install_root/bin/securityProcs.jacl install_root/bin/LTPA_LDAPSecurityProcs.jaclBy default, these files are in ASCII. If you use the profile.encoding option to run EBCDIC encoded profile script files, change the encoding of the default profile files to EBCDIC.
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.sh -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.