[英]How to get Wildfly server status via CLI?
I've been trying to validate if our server has started in Wildfly using the jboss-cli.bat 我一直在尝试使用jboss-cli.bat验证我们的服务器是否已在Wildfly中启动
This is the command i'm using: 这是我正在使用的命令:
/host=slave-1/server-config=REST-server-one:read-resource(include-runtime=true)
and this is what i'm getting from the command 这就是我从命令中得到的
{
"outcome" => "success",
"result" => {
"auto-start" => true,
"cpu-affinity" => undefined,
"group" => "wildfly-server-group",
"name" => "wildfly-server",
"priority" => undefined,
"socket-binding-default-interface" => undefined,
"socket-binding-group" => undefined,
"socket-binding-port-offset" => 0,
"status" => "STARTED",
"update-auto-start-with-server-status" => false,
"interface" => undefined,
"jvm" => undefined,
"path" => undefined,
"ssl" => undefined,
"system-property" => undefined
}
Is there a command that will return the value of the status in that response? 是否有命令将返回该响应中的状态值?
您应该能够使用read-attribute
操作。
/host=slave-1/server-config=REST-server-one:read-attribute(name=status)
I end up using this 我最终用这个
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = reader.readLine();
while (line != null) {
String[] value = line.split("=>");
if(value.length > 1){
if(value[0].contains("\"status\"")){
System.out.println(value[1]);
}
}
line = reader.readLine();
}
If anyone can suggest a better method would be greatly appreciated. 如果有人可以提出更好的方法,将不胜感激。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.