WAS 控制台 命令 脚本 jacl代码参考

jacl代码参考

转载请标明出处http://blog.csdn.net/keyboardsun http://www.chinacsharp.net keyboardsun

Appendix A: Exercises (available for copy-and-paste)
Lesson 2 Exercises


lesson2a.jacl
set list [$AdminApp list]
puts stdout $list


LESSON2B.JCL
//************************************************
//* STEP 1 - Invoke WSADMIN, issue command
//************************************************
//INST1 EXEC PGM=IKJEFT01,REGION=0M
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
BPXBATCH SH +
/wasv5config/azcell+
/DeploymentManager+
/bin/wsadmin.sh -conntype none +
-c '$AdminApp list' +
1> /tmp/lesson2b.out +
2> /tmp/lesson2b.err
/*
//**************************************
//* STEP Copy - Copy script output back to joblog
//************************************************
//DIAPPC EXEC PGM=IKJEFT01,REGION=0M
//SYSEXEC DD DISP=SHR,DSN=WAS502.WAS.SBBOEXEC
//SYSTSIN DD *
BBOHFSWR '/tmp/lesson2b.out'
BBOHFSWR '/tmp/lesson2b.err'
//SYSTSPRT DD SYSOUT=*
//


lesson2c.jacl
set list [$AdminApp list]
puts stdout $list
LESSON2C.JCL
//*************************************************
//* STEP 1 - Invoke WSADMIN, point to file
//*************************************************
//INST1 EXEC PGM=IKJEFT01,REGION=0M
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
BPXBATCH SH +
/wasv5config/azcell+
/DeploymentManager+
/bin/wsadmin.sh +
-javaoption -Dscript.encoding=Cp1047 +
-conntype none +
-f /u/user1/lesson2c.jacl +
1> /tmp/lesson2c.out +
2> /tmp/lesson2c.err
/*
//*************************************************
//* STEP Copy - Copy script output back to joblog
//*************************************************
//DIAPPC EXEC PGM=IKJEFT01,REGION=0M
//SYSEXEC DD DISP=SHR,DSN=WAS502.WAS.SBBOEXEC
//SYSTSIN DD *
BBOHFSWR '/tmp/lesson2c.out'
BBOHFSWR '/tmp/lesson2c.err'
//SYSTSPRT DD SYSOUT=*
//



lesson3c.jacl
set string "Four Score and Seven"
set first [lindex $string 0]
set second [lindex $string 1]
set third [lindex $string 2]
set fourth [lindex $string 3]
puts stdout "1st:$first 2nd:$second 3rd:$third 4th:$fourth"


lesson3d.jacl
set cell [lindex $argv 0]
set node [lindex $argv 1]
set server [lindex $argv 2]
set appl [lindex $argv 3]
puts stdout "C:$cell N:$node S:$server A:$appl"


lesson3e.jacl
if { !($argc==3) } then {
puts stdout "You supplied $argc parameters, not three. Try again"
} else {
set cell [lindex $argv 0]
set node [lindex $argv 1]
set server [lindex $argv 2]
puts stdout "Parameters: cell:$cell node:$node server:$server"
}


lesson3f.jacl
set node "<node>"
set server "<server>"
set ear "/u/user1/MyIVT.ear"
set opt [list -node $node -server $server]
puts stdout "AdminApp install $ear $opt"





lesson4b.jacl
$AdminApp uninstall My_IVT_Application
$AdminConfig save



lesson4d.jacl
set ear "/u/user1/MyIVT.ear"
set node "<node>"
set server "<server>"
set WebMod "/"My_IVT_Webapp_Display_Name/""
set uri "MyIVTWebApp.war,WEB-INF/web.xml"
set VH "WSC_host"
# -------------------------------------------------------------------
set VHlist "$WebMod $uri $VH"
set VHopts [list $VHlist]
set options [list -node $node -server $server -MapWebModToVH $VHopts]
# -------------------------------------------------------------------
$AdminApp install $ear $options
$AdminConfig save


lesson4e.jacl
set parm [lindex $argv 0]
if { !($parm == 1 || $parm == 2) } then {
puts stdout "Must supply either 1 for install or 2 for uninstall"
exit
}
# EAR FILE, OPTIONS ----------------------------------------------
set ear "/u/user1/MyIVT.ear"
set name "My_IVT_Application"
set node "<node>"
set server "<server>"
set opts [list -node $node -server $server]
# INSTALL/UNINSTALL ----------------------------------------------
if { ($parm == 1) } then {
puts stdout "Installing $name"
$AdminApp install $ear $opts
$AdminConfig save
} else {
puts stdout "Uninstalling $name"
$AdminApp uninstall $name
$AdminConfig save
}
# ----------------------------------------------------------------
puts stdout "All done."



lesson5a.jacl
set cellid [$AdminConfig getid /Cell:<cell>/]
puts stdout $cellid


lesson5b.jacl
set cellid [$AdminConfig getid /Cell:<cell>/]
$AdminConfig create VirtualHost $cellid {{name Test_VH}}
$AdminConfig save


lesson5c.jacl
set vh_id [$AdminConfig getid /VirtualHost:default_host/]
puts stdout "ID of VirtualHost is $vh_id"


lesson5d.jacl
set vh_id [$AdminConfig getid /VirtualHost:default_host/]
set show_out [$AdminConfig show $vh_id]
puts stdout "Attributes are $show_out"


lesson5e.jacl
set vh_id [$AdminConfig getid /VirtualHost:default_host/]
set show_out [$AdminConfig showAttribute $vh_id aliases]
puts stdout "Attributes are $show_out"


lesson5f.jacl
set alias_id "(cells/<cell>:virtualhosts.xml#HostAlias_1)"
puts stdout [$AdminConfig show $alias_id]



lesson5h.jacl
set cell_id [$AdminConfig getid /Cell:<cell>/]
$AdminConfig create VirtualHost $cell_id {{name New_VH} {aliases {{{port 7777} {hostname *}}}}}
$AdminConfig save
puts stdout [$AdminConfig list VirtualHost]


lesson5i.jacl
set cell "<cell>"
set vh_name "New_VH2"
set host1 "*"
set port1 "8888"
# ---------------------------------------------------
set cell_id [$AdminConfig getid /Cell:$cell/]
# ---------------------------------------------------
set name [list "name" $vh_name]
set p1 [list port $port1]
set h1 [list hostname $host1]
set pair1 [list $p1 $h1]
set alias_attrs [list $pair1]
set aliases [list aliases $alias_attrs]
set VH_attrs [list $name $aliases]
# ---------------------------------------------------
$AdminConfig create VirtualHost $cell_id $VH_attrs
$AdminConfig save
# ---------------------------------------------------
puts stdout [$AdminConfig list VirtualHost]


lesson5i-2.jacl
set cell "<cell>"
set vh_name "New_VH3"
set host1 "*"
set port1 "8888"
set host2 "


lesson5j.jacl
set exist_name "New_VH2"
set new_name "Mod_VH2"
# --------------------------------------------------------
set vh_id [$AdminConfig getid /VirtualHost:$exist_name/]
# --------------------------------------------------------
set name_list [list name $new_name]
set attr_list [list $name_list]
# --------------------------------------------------------
$AdminConfig modify $vh_id $attr_list
$AdminConfig save
# --------------------------------------------------------
puts stdout [$AdminConfig list VirtualHost]


lesson5k.jacl
set vh_name "New_VH2"
set port1 "5555"
set host1 "*"
set port2 "6666"
set host2 "*"
# --------------------------------------------------------
set vh_id [$AdminConfig getid /VirtualHost:$vh_name/]
# --------------------------------------------------------
set p1 [list port $port1]
set h1 [list hostname $host1]
set pair1 [list $p1 $h1]
set p2 [list port $port2]
set h2 [list hostname $host2]
set pair2 [list $p2 $h2]
set pair_list [list $pair1 $pair2]
set alias_list [list aliases $pair_list]
set attr_list [list $alias_list]
# --------------------------------------------------------
$AdminConfig modify $vh_id $attr_list
$AdminConfig save
# --------------------------------------------------------
puts stdout [$AdminConfig list VirtualHost]


lesson5l.jacl
set vh_name "New_VH2"
set vh_id [$AdminConfig getid /VirtualHost:$vh_name/]
# --------------------------------------------------------
$AdminConfig remove $vh_id
$AdminConfig save
# --------------------------------------------------------
puts stdout [$AdminConfig list VirtualHost]


lesson5m.jacl
set model_serv [$AdminConfig getid /Server:<serve_long>/]
set parent_node [$AdminConfig getid /Node:<node_long>/]
$AdminConfig createUsingTemplate Server $parent_node {{name <serve_long>}} $model_serv
$AdminConfig save


lesson5n.jacl
set model_serv "<model_server_long>"
set new_serv_name "<new_server_long>"
set parent "<node_long>"
# ------------------------------------------------------------
set m_ID [$AdminConfig getid /Server:$model_serv/]
set p_ID [$AdminConfig getid /Node:$parent/]
# ------------------------------------------------------------
set name_pair [list name $new_serv_name]
set attr_list [list $name_pair]
# ------------------------------------------------------------
$AdminConfig createUsingTemplate Server $p_ID $attr_list $m_ID
$AdminConfig save
# ------------------------------------------------------------
set var [$AdminControl completeObjectName type=NodeSync,node=$parent,*]
$AdminControl invoke $var sync



lesson5o.jacl
set server_long "<server_long>"
set new_short "<server_short>"
set parent "<node_long>"
set server_id [$AdminConfig getid /Server:$server_long/]
# --------------------------------------------------------
set name_list [list shortName $new_short]
set attr_list [list $name_list]
# --------------------------------------------------------
$AdminConfig modify $server_id $attr_list
$AdminConfig save
# --------------------------------------------------------
set var [$AdminControl completeObjectName type=NodeSync,node=$parent,*]
$AdminControl invoke $var sync


lesson5p.jacl
set server_long "<server_long>"
set parent "<node_long>"
set new_CTN "<NEW_CLUSTER_TRAN>"
# ------------------------------------------------------------
set server_ID [$AdminConfig getid /Server:$server_long/]
set appl_serv_ID [$AdminConfig list ApplicationServer $server_ID]
set prop_list [$AdminConfig list Property $appl_serv_ID]
set ctn_prop [lindex $prop_list 0]
set first_seven [string range $ctn_prop 0 6]
# ------------------------------------------------------------
if { !($first_seven=="Cluster") } then {
puts stdout "Got wrong property!"
exit
}
# ------------------------------------------------------------
set value_pair [list value $new_CTN]
set attr_list [list $value_pair]
$AdminConfig modify $ctn_prop $attr_list
$AdminConfig save
# ------------------------------------------------------------
set var [$AdminControl completeObjectName type=NodeSync,node=$parent,*]
$AdminControl invoke $var sync


Lesson 6 Exercises
LESSON6A.JCL

//**************************************************
//* STEP 1 - Start Server
//**************************************************
//INST1 EXEC PGM=IKJEFT01,REGION=0M
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
BPXBATCH SH +
/<config root>+
/DeploymentManager+
/bin/wsadmin.sh +
-conntype SOAP +
-host <host> +
-port <port> +
-c '$AdminControl startServer <server> <node>' +
1> /tmp/lesson6a.out +
2> /tmp/lesson6a.err
/*
//**************************************************
//* STEP Copy - Copy script output back to joblog
//**************************************************
//DIAPPC EXEC PGM=IKJEFT01,REGION=0M
//SYSEXEC DD DISP=SHR,DSN=WAS502.WAS.SBBOEXEC
//SYSTSIN DD *
BBOHFSWR '/tmp/lesson6a.out'
BBOHFSWR '/tmp/lesson6a.err'
//SYSTSPRT DD SYSOUT=*
//
lesson6b.jacl

set server [$AdminControl completeObjectName
cell=<cell>,node=<node>,name=<server>,type=Server,*]
puts stdout [$AdminControl getAttribute $server state]


lesson6c.jacl
set appManager [$AdminControl queryNames
cell=<cell>,node=<node>,type=ApplicationManager,process=<server>,*]
$AdminControl invoke $appManager startApplication My_IVT_Application

lesson6d.jacl
set appManager [$AdminControl queryNames
cell=<cell>,node=<node>,type=ApplicationManager,process=<server>,*]
$AdminControl invoke $appManager stopApplication My_IVT_Application

lesson6e.jacl
set app_name "My_IVT_Application"
# ----------------------------------------------
set status [$AdminControl completeObjectName type=Application,name=$app_name,*]
# ----------------------------------------------
set length [string length $status]
if { ($length==0) } then {
puts stdout "Application is STOPPED"
} else {
puts stdout "Application is STARTED"
}


Lesson 7 Exercises
lesson7a.jacl

$AdminApp install /u/user1/MyIVT.ear {-node <node> -server <server>
-appname My_IVT_Application2}
$AdminConfig save
set var [$AdminControl completeObjectName type=NodeSync,node=<node>,*]
$AdminControl invoke $var sync

lesson7b.jacl
$AdminApp install /u/user1/MyIVT.ear {-node <node> -server <server>
-BindJndiForEJBNonMessageBinding {{"My IVT EJB Module Display Name" My_IVT_EJB_Name
MyIVTStatelessSession.jar,META-INF/ejb-jar.xml ejb/New_JNDI}}}
set var [$AdminControl completeObjectName type=NodeSync,node=<node>,*]
$AdminControl invoke $var sync


lesson7c.jacl
$AdminApp install /u/user1/MyIVT.ear {-node <node> -server <server>
-MapEJBRefToEJB {{"My_IVT_Webapp_Display_Name" "" MyIVTWebApp.war,WEB-INF/web.xml
ejb/ivtEJBObject com.ibm.websphere.ivt.ivtEJB.ivtEJBObject ejb/New_JNDI}}}
set var [$AdminControl completeObjectName type=NodeSync,node=<node>,*]
$AdminControl invoke $var sync


lesson7d.jacl
# -------------------------------------------------------------------
# Application and Target settings
# -------------------------------------------------------------------
set ear_file "/u/user1/MyIVT.ear"
set server "<server>"
set node "<node>"
# -------------------------------------------------------------------
# BindJndiForEJBNonMessageBinding settings
# -------------------------------------------------------------------
set b_option "-BindJndiForEJBNonMessageBinding"
set b_mod "/"My IVT EJB Module Display Name/""
set b_ejb "My_IVT_EJB_Name"
set b_uri "MyIVTStatelessSession.jar,META-INF/ejb-jar.xml"
set b_jndi "ejb/New_JNDI"
# -------------------------------------------------------------------
# MapEJBRefToEJB settings
# -------------------------------------------------------------------
set m_option "-MapEJBRefToEJB"
set m_mod "/"My_IVT_Webapp_Display_Name/""
set m_ejb "/"/""
set m_uri "MyIVTWebApp.war,WEB-INF/web.xml"
set m_ref "ejb/ivtEJBObject"
set m_class "com.ibm.websphere.ivt.ivtEJB.ivtEJBObject"
set m_jndi $b_jndi
# -------------------------------------------------------------------
# Construct BindJndiForEJBNonMessageBinding option list
# -------------------------------------------------------------------
set b_string "$b_mod $b_ejb $b_uri $b_jndi"
set b_list [list $b_string]
# -------------------------------------------------------------------
# Construct MapEJBRefToEJB option list
# -------------------------------------------------------------------
set m_string "$m_mod $m_ejb $m_uri $m_ref $m_class $m_jndi"
set m_list [list $m_string]
# -------------------------------------------------------------------
# Construct $AdminApp command
# -------------------------------------------------------------------
set cmd_opt_list [list -node $node -server $server]
lappend cmd_opt_list $b_option
lappend cmd_opt_list $b_list
lappend cmd_opt_list $m_option
lappend cmd_opt_list $m_list
$AdminApp install $ear_file $cmd_opt_list
$AdminConfig save
# -------------------------------------------------------------------
# Invoke node synchronization
# -------------------------------------------------------------------
set var [$AdminControl completeObjectName type=NodeSync,node=$node,*]
$AdminControl invoke $var sync

lesson7e.jacl
$AdminApp install /u/user1/MyIVT.ear {-node <node> -server <server>
-update -appname My_IVT_Application}
$AdminConfig save
set var [$AdminControl completeObjectName type=NodeSync,node=<node>,*]
$AdminControl invoke $var sync
lesson7f.jacl
$AdminApp install /u/user1/MyIVT.ear {-node <node> -server <server>
-update -update.ignore.new -appname My_IVT_Application}
$AdminConfig save
set var [$AdminControl completeObjectName type=NodeSync,node=<node>,*]
$AdminControl invoke $var sync


lesson7g.jacl
# -------------------------------------------------------------------
# Application and Target settings
# -------------------------------------------------------------------
set ear_file "/u/user1/BeCashAc.ear"
set server "<server>"
set node "<node>"
# -------------------------------------------------------------------
# MapResRefToEJB settings
# -------------------------------------------------------------------
set r_option "-MapResRefToEJB"
set r_mod "/"BeCashAcEJB/""
set r_ejb "/"BeCashAcSession/""
set r_uri "BeCashAcEJB.jar,META-INF/ejb-jar.xml"
set r_ref "CICSConnectionFactory "
set r_class "javax.resource.cci.ConnectionFactory"
set r_jndi "eis/My_CICS_CF"
# -------------------------------------------------------------------
# Construct MapResRefToEJB option list
# -------------------------------------------------------------------
set r_string "$r_mod $r_ejb $r_uri $r_ref $r_class $r_jndi"
set r_list [list $r_string]
# -------------------------------------------------------------------
# Construct $AdminApp command
# -------------------------------------------------------------------
set cmd_opt_list [list -node $node -server $server]
lappend cmd_opt_list $r_option
lappend cmd_opt_list $r_list
$AdminApp install $ear_file $cmd_opt_list
$AdminConfig save
# -------------------------------------------------------------------
# Invoke node synchronization
# -------------------------------------------------------------------
set var [$AdminControl completeObjectName type=NodeSync,node=$node,*]
$AdminControl invoke $var sync


Lesson 8 Exercises
lesson8a.jacl

$AdminApp install /u/user1/MyIVT.ear {-cluster <cluster>}
$AdminConfig save
lesson8b.jacl
$AdminApp install /u/user1/MyIVT.ear {-cluster <cluster>}
$AdminConfig save
set var [$AdminControl completeObjectName type=NodeSync,node=<node_1>,*]
$AdminControl invoke $var sync
set var [$AdminControl completeObjectName type=NodeSync,node=<node_2>,*]
$AdminControl invoke $var sync

synch_cluster.jacl
set c_id [$AdminConfig getid /ServerCluster:<cluster_long>/]
set c_membs [$AdminConfig list ClusterMember $c_id]
foreach m_id $c_membs {
set node_name [$AdminConfig showAttribute $m_id nodeName]
set nodeSync [$AdminControl completeObjectName type=NodeSync,node=$node_name,*]
set work [$AdminControl invoke $nodeSync sync]
}


lesson8c.jacl
set cluster [$AdminControl completeObjectName type=Cluster,name=<cluster_long>,*]
$AdminControl invoke $cluster start


lesson8d.jacl
set cluster [$AdminControl completeObjectName type=Cluster,name=<cluster_long>,*]
$AdminControl invoke $cluster stop


lesson8e.jacl
set cluster [$AdminControl completeObjectName type=Cluster,name=<cluster_long>,*]
$AdminControl getAttribute $cluster state 

lesson5o-pre.jacl
set server_long "<new_server_long>"
set server_id [$AdminConfig getid /Server:$server_long/]
# --------------------------------------------------------
puts stdout [$AdminConfig show $server_id]www.myhost.com"
set port2 "9999"
# ---------------------------------------------------
set cell_id [$AdminConfig getid /Cell:$cell/]
# ---------------------------------------------------
set name [list "name" $vh_name]
set p1 [list port $port1]
set h1 [list hostname $host1]
set pair1 [list $p1 $h1]
set p2 [list port $port2]
set h2 [list hostname $host2]
set pair2 [list $p2 $h2]
set alias_attrs [list $pair1 $pair2]
set aliases [list aliases $alias_attrs]
set VH_attrs [list $name $aliases]
# ---------------------------------------------------
$AdminConfig create VirtualHost $cell_id $VH_attrs
$AdminConfig save
# ---------------------------------------------------
puts stdout [$AdminConfig list VirtualHost] lesson5g.jacl
set alias_id "(cells/<cell>:virtualhosts.xml#HostAlias_1)"
puts stdout [$AdminConfig showAttribute $alias_id port] Lesson 5 Exercises
synch_all.jacl

set node_ids [$AdminConfig list Node]
foreach node $node_ids {
set node_name [$AdminConfig showAttribute $node name]
set nodeSync [$AdminControl completeObjectName type=NodeSync,node=$node_name,*]
if { !($nodeSync=="") } then {
$AdminControl invoke $nodeSync sync
}
} lesson4c.jacl
$AdminApp install /u/user1/MyIVT.ear {-node <node> -server <server> -MapWebModToVH
{{"My_IVT_Webapp_Display_Name" MyIVTWebApp.war,WEB-INF/web.xml WSC_host}}}
$AdminConfig save Lesson 4 Exercises
lesson4a.jacl

$AdminApp install /u/user1/MyIVT.ear {-node <node> -server <server>}
$AdminConfig save lesson3g.jacl
set inner [list opt1a opt1b opt1c]
set outer [list -opt1 $inner]
puts stdout "task $outer" lesson3h.jacl
set inopt1 [list opt1a opt1b]
set inopt2 [list opt2a opt2b]
set outer [list -opt1 $inopt1 -opt2 $inopt2]
puts stdout "task $outer" lesson3b.jacl
set cell "mycell"
set node "mynode"
set server "Server1"
set appl "my_appl"
puts stdout "C:$cell N:$node S:$server A:$appl" Lesson 3 Exercises
lesson3a.jacl

set server "Server1"
puts stdout $server

你可能感兴趣的:(server,list,脚本,ejb,application,pair)