Stop servers using scripting
You can stop servers using scripting and the wsadmin tool. Before starting this task, the wsadmin tool must be running. See the Start the wsadmin scripting client article for more information.
Procedure
Use the stopServer command to stop the server. This command has several syntax options. For example:
- To stop a server on a WAS single server edition, choose one of the following options:
- The following examples specify the server name only:Using Jacl:
$AdminControl stopServer serverNameUsing Jython:
AdminControl.stopServer('serverName')
- The following examples stop an appserver with the node specified:
- Use Jacl:
$AdminControl stopServer serverName mynode
- Use Jython:
print AdminControl.stopServer('serverName', 'mynode')Example output:
WASX7337I: Invoked stop for server "serverName" Waiting for stop completion. WASX7264I: Stop completed for server "serverName" on node "mynode"
- The following examples specify the server name and immediate:
- Use Jacl:
$AdminControl stopServer serverName immediate
- Use Jython:
AdminControl.stopServer('serverName', immediate)
- To stop a server on a WAS network deployment edition, choose one of the following options:
- The following example specifies the server name and the node name:
- Use Jacl:
$AdminControl stopServer serverName nodeName
- Use Jython:
AdminControl.stopServer('serverName', 'nodeName')
- The following example specifies the server name, the node name, and immediate:
- Use Jacl:
$AdminControl stopServer serverName nodeName immediate
- Use Jython:
AdminControl.stopServer('serverName', 'nodeName', immediate)
Use the AdminControl object for scripted administration
Related Reference
Commands for the AdminControl object
stopServer command