I have a Websphere cell with 6 nodes(1 dmgr+5 nodeagents) and 30 jvms(5 jvms on each node). I want to kill all the 30 jvms by login into dmgr node server using wsadmin.sh from /opt/WebSphere/AppServer855/profiles/dmgrprofile/bin/. Could I have a jython script to achieve this? Please help me.
Note: I do not want to kill nodeagents or dmgr.
Thanks,
Kumar.
Use AdminTask.listServers command to get the list of all application servers in a cell, or on a specific node, and then iterate the list and stop server by using AdminControl.stopServer command.
all_servers=AdminTask.listServers('[-serverType APPLICATION_SERVER ]').splitlines()
for server in all_servers:
serverName=AdminConfig.showAttribute(server, 'name')
#stop server if its running
try:
AdminControl.stopServer(serverName,'immediate')
except:
print (serverName +" is not reachable")
Related
I want to start playing around with databases in Java to help with my university work however I can't get SQL Server to work properly. I've installed it using the wizard and selecting 'Basic' the installing SSMS. However when launching SSMS I get Error 26. When researching this it says to make sure that the SQL Server Browser service is running. Unfortunately this is the issue, every time I try to start the service it fails.
All the fixes I've seen about this topic have been related to servers on another machine where as I am trying to run the server on my own PC. I've tried them anyway but nothing has worked so far. The only thing I can find that might give you a clue in helping me is that in the log file it says that it failed to register the SPN.
When working on my local machine, I don't usually need SQL Server browser - but my SQL Server itself isn't set up to run automatically.
You can go to services (either via window and search for 'services', or in Windows 10 open the task manager, go to the last tab 'services'). Find the 'SQL Server' service (it helps to sort by description column) and right click -> start.
If you take note of the name (default is 'MSSQLSERVER') you can start the service (e.g., in a batch file, from command line) using sc start "MSSQLSERVER" (or whatever your server instance is called).
I have set up 2 rundecks in 2 VMs and mysql cluster so Rundeck #1 on VM#1 connects to Mysql DB#1 and similarly Rundeck #2 on VM#2 connects to Mysql DB#2.
The problem now I have is whenever I am creating a project / job in rundeck #1 that I am not able to see it in rundeck #2. What should I do?
Any help will be appreciated
I would first try to switch the databases, i.e. Rundeck#2 connects to MySql DB#1 to see if the jobs are visible.
If this is the case, then you have a sync issue.
If jobs are still not visible, then i assume that there are some identification problems of the Rundeck instances.
Just my 2 cents.
The issue can be fixed by maintaining the default engine in my.cnf.
So in my case I just modified the /etc/my.cnf
Introduced the following option below the header [mysqld]:
default-storage-engine=NDBCLUSTER
And did a mysql restart and the tables sync started to happen.
delete the rundeck db before proceeding with any modifications.
Thanks and hope this helps everyone facing such issues.
I want to shutdown weblogic server using command line FORCEFULLY. I have a specific scenario. I have written a batch file to do some stuff and then shutdown weblogic server using stopWebLogic.cmd as follows:
"%WEBLOGIC_DOMAIN_PATH%\bin\stopWebLogic.cmd"
I have gone through this document. But I can't follow the approach since I don't want to change stopWebLogic.cmd. Is there any way to achieve this?
A WLST script is probably the way to go. See the shutdown command which has an optional 'force' parameter.
N.B. On UNIX/Linux you can send a SIGTERM signal to the pid of a weblogic server which will perform a force shutdown. i.e. kill -term pid
You can use an existing file if you configure it to force the shutdown
head to bin/stopWebLogic.sh
Then modify the following line
echo "shutdown('${SERVER_NAME}','Server', ignoreSessions='true')" >>"shutdown.py"
to
echo "shutdown('${SERVER_NAME}','Server', ignoreSessions='true', force='true')" >>"shutdown.py"
Then execute the file using bash stopWeblogic.sh
The weblogic will be stopped, even if active sessions or listeners exist.
I am looking for some kind of framework that will allow me to do connect to multiple servers using SSH and keep the connection open, reopen it if it dies, and allow me to run commands to it and report back. For example, check disk space on all the machines right away, so I'd do results = object.run("df -h") and it returns an array with the response from all the machines (I am not looking for a monitoring system).
Anyone have any idea?
I would use Python and the Fabric framework. Lets you easily execute commands on a set of servers - like doing deployment
with Fabric you could do
from fabric import run, env
def getSpace(server):
env.host_string
run("df -h")
>>> fab getSpace("234.24.32.1")
One way to do this would be to use Python and the paramiko library. Writing the functionality that runs a given command on a specified set of servers is then a simple matter of programming.
I manage seven Weblogic servers for development and test. I use WLST scripts to start and stop them. This works perfectly for six of the servers, but one of them will not stop when I run the script to stop it. The start script starts it but the stop script doesn't stop it.
I'm executing the same scripts for all seven servers, it's just different parameters. WLST says it successfully shut down the server, but it's lying. It also says this very quickly (it takes a few seconds for the ones it actually shuts down).
Has anyone else had this problem? Do you have any clues as to what I should be looking at?
The servers are version 9.2. My stop script looks like this:
from java.util import *
from javax.management import *
print 'starting the script ....'
argslength = len(sys.argv)
if argslength < 2 :
print '==>Insufficient arguments'
print '==>Syntax: java weblogic.WLST stop.py domain server'
exit()
else:
domain = sys.argv[1]
server = sys.argv[2]
print 'stopping server ', server, ' in domain ', domain
nmConnect(adminId, password, host, '5556', domain)
nmKill(server)
nmDisconnect()
exit()
In the real script that adminId, password and host are hard coded.
If you already resolved share your thought...
Correct me if I m wrong...
You have multiple domains on the same machine. You wish to stop all the servers by using NM.
Did you check the server which is not shutdown (lying server :)) is that enrolled by nmEnroll()?