Network Deployment (Distributed operating systems), v8.0 > Scripting the application serving environment (wsadmin) > Manage servers and nodes with scripting


Query server state using scripting


Overview

We can use wsadmin.sh and scripting to query server states.

When querying the server state, the following command steps return a value of STARTED if the server is started. If the server is stopped, the command does not return a value.

In a WAS ND environment, you also can query for the server status from the dmgr. If the server is active, the command returns the STARTED return value. If the server is stopped, the command returns the STOPPED return value.


Query the server state

### Jacl

### Identify the server and assign it to the server variable.
### If server stopped, completeObjectName returns an empty string ('').
###

set server [$AdminControl completeObjectName cell=mycell,node=mynode, name=server1,type=Server,*]

### Query for the state attribute.
### getAttribute returns the value of a single attribute.

$AdminControl getAttribute $server state



### Jython

server = AdminControl.completeObjectName('cell=mycell,node=mynode, name=server1,type=Server,*')
print server print AdminControl.getAttribute(server, 'state')

AdminControl
Start the wsadmin scripting client
Commands for the AdminControl object

+

Search Tips   |   Advanced Search