wscp examples for WebSphere

Technote (FAQ)
Problem
wscp examples for WebSphere
Solution

WSCP

WebSphere Objects
ApplicationServerContextDataSource
DrAdminEJBContainerEnterpriseApplication
EnterpriseBeanGenericServerHelp
JDBCDriverModelNode
RemoteServletServletEngine
ServletRedirectorSessionManagerUserProfile
VirtualHostWebApplicationWebResource
XMLConfig

Syntax:
<object><action> [name] [options]

Syntax for help:
To list all actions an object supports: <object> help
To list all the options for an action: <object> help <action>
For verbose information on an action: <object> help <action> -verbose

Example:
List all commands for a specific WebSphere object.
wscp>ApplicationServer help

The following actions are available for ApplicationServer
    attributes
    Display the attributes of the object
    containment
    Display the containment hierarchy for the object
    create
    Create the specified object
    defaults
    Display or set attribute defaults
    help
    Display this help message
    list
    Display all the instances of this type
    modify
    Modify the attributes of the specified object
    operations
    List all the actions available on the object type
    remove
    Remove the specified object
    show
    Display the attributes of specified object
    start
    Start the specified object
    stop
    Stop the specified object

Other Examples:
wscp>DataSource list
{/DataSource:Default DataSource/}

wscp>ApplicationServer list
{/Node:porkypig/ApplicationServer:Default Server/}

wscp>Help DataSource
ApplicationServer show {/Node:porkypig/ApplicationServer:Default Server/} -attribute Help

wscp>DataSource show {/DataSource:Default DataSource/}
{FullName {/DataSource:Default DataSource/}} {Name {Default DataSource} {ConnTi
meout 120000} {DatabaseName was} {IdleTimeout 180000} {JDBCDriver {/JDBCDriver:A
dmin DB Driver/}} {MaxPoolSize 10} {MinPoolSize 1} {OrphanTimeout 1800000}

wscp>Node show {/Node:porkypig/}
{FullName /Node:porkypig/} {Name porkypig} {CurrentState Running} {DesiredState
Running} {StartTime 984073643857} {DependentClasspath {}} {DeployedJarDirectory
{f:\WebSphere\AppServer\deployedEJBs}} {HostName porkypig} {HostSystemType x86}
{InstallRoot {f:\WebSphere\AppServer}} {ProcessId 101}

wscp>ApplicationServer show {/Node:porkypig/ApplicationServer:Default Server/}
{FullName {/Node:porkypig/ApplicationServer:Default Server/}} {Name {Default Se
ver}} {CurrentState Running} {DesiredState Running} {StartTime 984074337514} {C
mmandLineArgs {}} {CommandLineArgsActive {-Xdebug -Djava.compiler=NONE -Xbootcl
sspath:f:\WebSphere\AppServer\jdk\jre\lib\rt.jar;f:\WebSphere\AppServer\jdk\jre
..\lib\tools.jar;f:\WebSphere\AppServer\lib\derdbpw.jar -classpath C:/SQLLIB/ja
a/db2java.zip;f:/WebSphere/AppServer/lib/ibmwebas.jar;f:/WebSphere/AppServer/pr
perties;f:/WebSphere/AppServer/lib/servlet.jar;f:/WebSphere/AppServer/lib/webtl
rn.jar;f:/WebSphere/AppServer/lib/lotusxsl.jar;f:/WebSphere/AppServer/lib/compa
.jar;f:/WebSphere/AppServer/lib/xalan.jar;f:/WebSphere/AppServer/lib/ns.jar;f:/
ebSphere/AppServer/lib/ejs.jar;f:/WebSphere/AppServer/lib/ujc.jar;C:/SQLLIB/jav
/db2java.zip;f:/WebSphere/AppServer/lib/repository.jar;f:/WebSphere/AppServer/l
b/admin.jar;f:/WebSphere/AppServer/lib/swingall.jar;f:/WebSphere/AppServer/lib/
onsole.jar;f:/WebSphere/AppServer/lib/was20cm.jar;f:/WebSphere/AppServer/lib/ta
ks.jar;f:/WebSphere/AppServer/lib/xml4j.jar;f:/WebSphere/AppServer/lib/vaprt.ja
;f:/WebSphere/AppServer/lib/sslight.jar;f:/WebSphere/AppServer/lib/ibmjndi.jar;
:/WebSphere/AppServer/lib/deployTool.jar;f:/WebSphere/AppServer/lib/databeans.j
r;f:/WebSphere/AppServer/classes;f:/WebSphere/AppServer/jdk/lib/tools.jar;f:/We
Sphere/AppServer/lib/bsf.jar;f:/WebSphere/AppServer/lib/dertrjrt.jar;f:/WebSphe
e/AppServer/lib/derdbpw.jar;f:/WebSphere/AppServer/lib/ivjejb35.jar;f:/WebSpher
/AppServer/lib/js.jar;f::/WebSphere/AppServer/hosts/default_host/default_app/se
vlets/ -Dserver.root=f:\WebSphere\AppServer -Dwas.debug.enabled=true -Dcom.ibm.
js.sm.adminServer.qualifyHomeName=true -Dcom.ibm.ejs.sm.adminServer.primaryNode
porkypig com.ibm.ejs.sm.server.ManagedServer -name {/ActiveNode:porkypig:47:13/
ctiveEJBServerProcess:Default Server:51:1/} -trace *=all=disabled:com.ibm.ejs.*
all=disabled:com.ibm.ejs.*=debug=enabled:Servlet_Transport=all=disabled:Servlet
Engine=all=disabled:Servlet_Utils=all=disabled:Servlet_Config=all=disabled -nod
Agent IOR:0000000000000035524d493a636f6d2e69626d2e656a732e736d2e6167656e742e416
6d696e4167656e743a3030303030303030303030303030303000000000000000010000000000000
94000101000000000b392e332e3136302e3130000023280000000000534a4d42490000001233c5f
dd31303030303030303030303030303030000000240000002f49454a5001000d5f5f61646d696e5
65727665720c41646d696e4167656e744f410000000a41646d696e4167656e74000000000100000
0100000018000000000001000100000001000100200001010000000000 -tranLog IOR:0000000
00000039524d493a636f6d2e69626d2e656a732e6a74732e7472616e4c6f672e7472616e4c6f675
6972653a30303030303030303030303030303030000000000000000100000000000000980001010
0000000b392e332e3136302e3130000023280000000000574a4d42490000001233c5f0dd3130303
303030303030303030303030000000240000003349454a5001000d5f5f61646d696e53657276657
0f7472616e4c6f6753696d706c654f410000000b7472616e4c6f675769726500000000010000000
00000018000000000001000100000001000100200001010000000000 -bootstrapPort 900 -ls
Port 9000 -olt -oltServerHost localhost -oltServerPort 2102 -threadPoolSize 20}
{Environment {}} {EnvironmentActive {}} {Executable java} {ExecutableActive {f
\WebSphere\AppServer\jdk\jre\bin\java}} {GroupId {}} {GroupIdActive {}} {MaxSta
tupAttempts 2} {PingInitialTimeout 300} {PingInterval 60} {PingTimeout 200} {Pr
cessId 400} {ProcessPriority 20} {ProcessPriorityActive 20} {SelectionPolicy ro
ndrobinpreferlocal} {ServerId 51} {ServerInstance 12} {Stderr {f:\WebSphere\App
erver/logs/default_server_stderr.log}} {StderrActive {f:\WebSphere\AppServer/lo
s/default_server_stderr.log}} {Stdin {}} {StdinActive {}} {Stdout {f:\WebSphere
AppServer/logs/default_server_stdout.log}} {StdoutActive {f:\WebSphere\AppServe
/logs/default_server_stdout.log}} {Umask 18} {UmaskActive 18} {UserId {}} {User
dActive {}} {WorkingDirectory {}} {WorkingDirectoryActive {}} {AdminAgentIOR IO
:0000000000000035524d493a636f6d2e69626d2e656a732e736d2e6167656e742e41646d696e41
7656e743a3030303030303030303030303030303000000000000000010000000000000094000101
00000000b392e332e3136302e3130000023280000000000544a4d42490000001242f65a47333330
0303030303030303030303030000000240000003049454a5001000e44656661756c742053657276
5720c41646d696e4167656e744f410000000a41646d696e4167656e740000000100000001000000
8000000000001000100000001000100200001010000000000} {DebugEnabled True} {DebugEn
bledActive True} {EpmSpec {}} {LogFileSpec {}} {LogFileSpecActive {}} {OLTEnabl
d True} {OLTEnabledActive True} {OLTServerHost localhost} {OLTServerHostActive
ocalhost} {OLTServerPort 2102} {OLTServerPortActive 2102} {SecurityEnabled Fals
} {SecurityEnabledActive False} {SourcePath {}} {SourcePathActive {}} {SystemPr
perties {}} {SystemPropertiesActive {}} {ThreadPoolSize 20} {TraceOutput {}} {T
aceOutputActive {}} {TraceSpec *=all=disabled:com.ibm.ejs.*=all=disabled:com.ib
.ejs.*=debug=enabled:Servlet_Transport=all=disabled:Servlet_Engine=all=disabled
Servlet_Utils=all=disabled:Servlet_Config=all=disabled} {TraceSpecActive *=all=
isabled:com.ibm.ejs.*=all=disabled:com.ibm.ejs.*=debug=enabled:Servlet_Transpor
=all=disabled:Servlet_Engine=all=disabled:Servlet_Utils=all=disabled:Servlet_Co
fig=all=disabled} {TranInactivityTimeout 60000} {TranTimeout 120}

wscp>ApplicationServer show {/Node:porkypig/ApplicationServer:Default Server/} -attribute {CurrentState}
{CurrentState Running}

wscp>JDBCDriver help
The following actions are available for JDBCDriver
attributesDisplay the attributes of the object
containmentDisplay the containment hierarchy for the object
createCreate the specified object
defaultsDisplay or set attribute defaults
helpDisplay this help message
installInstall a JDBC driver
listDisplay all the instances of this type
modifyModify the attributes of the specified object
operationsList all the actions available on the object type
removeRemove the specified object
showDisplay the attributes of specified object
uninstallUninstall the JDBC driver

wscp>JDBCDriver list
{/JDBCDriver:Admin DB Driver/}

wscp> VirtualHost help
The following actions are available for VirtualHost

attributesDisplay the attributes of the object
containmentDisplay the containment hierarchy for the object
createCreate the specified object
defaultsDisplay or set attribute defaults
helpDisplay this help message
helpDisplay all the instances of this type
modifyModify the attributes of the specified object
operationsList all the actions available on the object type
removeRemove the specified object
showDisplay the attributes of specified object

wscp> VirtualHost list
/VirtualHost:default_host/ /VirtualHost:default_host2/

wscp> ApplicationServer stop {/Node:<NodeName>/ApplicationServer:Default Server/}

wscp> ApplicationServer start {/Node:<NodeName>/ApplicationServer:Default Server/}

wscp> Node list
/Node:porkypig/

wscp> Node stop /Node:porkypig/

wscp> Node list(message after the node has been stopped)
CORBA COMM_FAILURE 3 No; nested exception is:
org.omg.CORBA.COMM_FAILURE: minor code: 3 completed: No
(re-started the admin server by hand and existed then rstarted wscp)
F:\WebSphere\AppServer\bin>wscp.bat

wscp> Node list
/Node:porkypig/

wscp> VirtualHost show /VirtualHost:default_host/
{Name default_host} {AliasList {localhost 127.0.0.1 porkypig 9.3.160.10}} {IsDefault True} {MimeTable {{wk4 application/vnd.lotus-1-2-3}{ief image/ief}{aiff aud
Running wscp from the command line:
wscp -c “command; command;command”

C:\WebSphere\AppServer\bin>wscp -c "ApplicationServer show
{/Node:pigpen/ApplicationServer:Default Server/} -attribute {CurrentState}"
{CurrentState Running}

C:\WebSphere\AppServer\bin>wscp -c "ApplicationServer stop {/Node:pigpen/ApplicationServer:Default Server/} ; ApplicationServer show {/Node:pigpen/ApplicationServer:Default Server/} -attribute {CurrentState}"
{CurrentState Stopped}
Running wscp from a script of commands
wscp -f filename

C:\WebSphere\AppServer\bin>wscp -f commandfile
{CurrentState Running}

C:\WebSphere\AppServer\bin>type commandfile (contents of comfile)
ApplicationServer start {/Node:pigpen/ApplicationServer:Default Server/}
ApplicationServer show {/Node:pigpen/ApplicationServer:Default Server/} -attribute {CurrentState}

An example of a script to start/stop all application servers.
===== Start of CommandFile.tcl ========================
# THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
# ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
# PARTICULAR PURPOSE.

# Get the command line argument (valid values are "start" or "stop")
set command [lindex $argv 0]

# Iterate through all of the Application Servers, starting/stopping them.
foreach object [ApplicationServer list] {
# Check if the server is running
set status [ApplicationServer show $object -attribute {Name CurrentState}]
set status [lindex $status 1]
puts "App Server $object $status\n"

# If the status/command correspond, start/stop the servers.
if { ($status == "CurrentState Stopped"&& $command == "start") ||
($status == "CurrentState Running"&& $command == "stop") } {
puts "Attempting to $command App Server $object\n"
ApplicationServer $command $object
}
}
===== End of CommandFile.tcl ========================

Example of bat file calling CommandFile.tcl
===== Start of appServer.bat ========================
REM THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
REM ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
REM THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
REM PARTICULAR PURPOSE.

@ECHO OFF
REM Batch file to start/stop WebSphere appservers
REM Change to the BIN directory of WebSphere
cd C:\WebSphere\AppServer\bin

REM Run the TCL script to stop all running AppServers
wscp -f CommandFile.tcl stop

REM Stop the WebSphere Administration Server
net stop "IBM WS AdminServer"

REM Do necessary maintanence

REM Start the WebSphere Administration Server
net start "IBM WS AdminServer"

REM Start up all the AppServers
wscp -f CommandFile.tcl start

REM All Done!
===== End of appServer.bat ========================











Document Information

Product categories: Software, Application Servers, Distributed Application & Web Servers, WebSphere Application Server, General
Operating system(s): Multi-Platform
Software version: 3.0, 3.5
Software edition: Standard, Advanced
Reference #: 1030972
IBM Group: Software Group
Modified date: 2003-04-25