Manage generic servers using scripting

 

Overview

A generic server is a server that the WAS manages but did not supply. Use WAS to define, start, stop, and monitor generic servers.

 

Steps for this task (dependent on configuration)

  • Start wsadmin

  • To define a generic server, use the following example:

    • Jacl

      $AdminTask createGenericServer mynode {-name generic1 -ConfigProcDef 
      {{"/usr/bin/myStartCommand" "arg1 arg2" "" "" "/tmp/workingDirectory" "/tmp/stopCommand" "argy argz"}}}
      $AdminConfig save
      

    • 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:

    • Jacl

      set nodeagent [$AdminControl queryNames *:*,type=NodeAgent]
      $AdminControl invoke $nodeagent launchProcess generic1
      

    • Jython

      nodeagent = AdminControl.queryNames ('*:*,type=NodeAgent')
      AdminControl.invoke(nodeagent, 'launchProcess', 'generic1')
      

    Example output

    true
    
    or
    false
    

  • To stop a generic server, use the terminate parameter, for example:

    • Jacl

      set nodeagent [$AdminControl queryNames *:*,type=NodeAgent]
      $AdminControl invoke $nodeagent terminate generic1
      

    • Jython

      nodeagent = AdminControl.queryNames ('*:*,type=NodeAgent')
      AdminControl.invoke(nodeagent, 'terminate', 'generic1')
      

    Example output

    true
    
    or
    false
    

  • To monitor the server state, use the getProcessStatus parameter, for example:

    • Jacl

      $AdminControl invoke $nodeagent getProcessStatus generic1
      

      Jython

      AdminControl.invoke(nodeagent, 'getProcessStatus', 'generic1')
      

    Example output

    RUNNING
    
    or
    STOPPED
    


     

    See Also


    AdminConfig object for scripted administration
    AdminControl object for scripted administration

     

    See Also


    Commands for the AdminConfig object
    Commands for the AdminControl object