Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wsadmin + jython restart WAS appserver

Is it possible to stop/start WAS appserver using wsadmin (jacl/jython). I want to detele all caches on profile and then restart WAS appserver. I'm using wsadmin as standalone.

like image 849
ekinek Avatar asked Nov 21 '12 13:11

ekinek


People also ask

How do I start wsadmin tool?

Run wsadmin with an option other than -f or -c or without an option. The wsadmin tool starts and displays an interactive shell with a wsadmin prompt. From the wsadmin prompt, enter any Jacl or Jython command. You can also invoke commands using the AdminControl, AdminApp, AdminConfig, AdminTask, or Help wsadmin objects.

What is wsadmin sh?

Overview. The wsadmin.sh utility provides the ability to execute scripts for managing a WAS installation. wsadmin.sh uses the Bean Scripting Framework, which supports a variety of scripting languages includng Jacl and Jython.


1 Answers

From wsadmin you may issue a command (using Jython):

AdminControl.invoke(AdminControl.queryNames('WebSphere:*,type=Server,node=%s,process=%s' % ('YourNodeName', 'YourServerName')), 'restart')

works with WAS Base & ND. With ND you have another option:

AdminControl.invoke(AdminControl.queryNames('WebSphere:*,type=Server,node=%s,process=%s' % ('YourNodeName', 'YourServerName')), 'stop')
# now your server is stopped, you can do any cleanup
# and then start the server with NodeAgent
AdminControl.invoke(AdminControl.queryNames('WebSphere:*,type=NodeAgent,node=%s' % 'YourNodeName'), 'launchProcess', ['YourServerName'], ['java.lang.String'])
like image 135
Marcin Płonka Avatar answered Sep 23 '22 23:09

Marcin Płonka