Manage generic servers using scripting
You can use WAS to define, start, stop, and monitor generic servers. Before starting this task, the wsadmin tool must be running. See the Start the wsadmin scripting client article for more information.
Overview
A generic server is a server that the WAS manages but did not supply.
Procedure
- To define a generic server, use the following example:
Use Jacl:
$AdminTask createGenericServer mynode {-name generic1 -ConfigProcDef {{"/usr/bin/myStartCommand" "arg1 arg2" "" "" "/tmp/workingDirectory" "/tmp/stopCommand" "argy argz"}}} $AdminConfig saveUse Jython:
AdminTask.createGenericServer('mynode', '[-name generic1 -ConfigProcDef [[c:\tmp\myStartCommand.exe "a b c" "" "" C:\tmp\myStopCommand "x y z"]]]') AdminConfig.save()
To start a generic server, use the launchProcess parameter, for example:
- Use Jacl:
set nodeagent [$AdminControl queryNames *:*,type=NodeAgent] $AdminControl invoke $nodeagent launchProcess generic1
- Use Jython:
nodeagent = AdminControl.queryNames ('*:*,type=NodeAgent') AdminControl.invoke(nodeagent, 'launchProcess', 'generic1')Example output:
trueorfalse
To stop a generic server, use the terminate parameter, for example:
- Use Jacl:
set nodeagent [$AdminControl queryNames *:*,type=NodeAgent] $AdminControl invoke $nodeagent terminate generic1
- Use Jython:
nodeagent = AdminControl.queryNames ('*:*,type=NodeAgent') AdminControl.invoke(nodeagent, 'terminate', 'generic1')Example output:
trueorfalse
To monitor the server state, use the getProcessStatus parameter, for example:
- Use Jacl:
$AdminControl invoke $nodeagent getProcessStatus generic1Using Jython:
AdminControl.invoke(nodeagent, 'getProcessStatus', 'generic1')Example output:
RUNNINGorSTOPPED
Use the AdminConfig object for scripted administration
Use the AdminControl object for scripted administration
Related Reference
Commands for the AdminConfig object
Commands for the AdminControl object