![如何检测 JBOSS 何时完全启动并运行并准备好接受部署?](https://linux22.com/image/108078/%E5%A6%82%E4%BD%95%E6%A3%80%E6%B5%8B%20JBOSS%20%E4%BD%95%E6%97%B6%E5%AE%8C%E5%85%A8%E5%90%AF%E5%8A%A8%E5%B9%B6%E8%BF%90%E8%A1%8C%E5%B9%B6%E5%87%86%E5%A4%87%E5%A5%BD%E6%8E%A5%E5%8F%97%E9%83%A8%E7%BD%B2%EF%BC%9F.png)
我有一个简单的“健全性检查”Web 应用程序,我希望在启动后立即将其部署在 JBoss EAP 服务器上。但“开始”是什么意思呢?如果我的调用 jboss cli 的脚本在 JBoss 报告完成后太快启动,我会收到一条消息说
{"WFLYDC0074: Operation failed or was rolled back on all servers. Server failures:" => {"server-group" => {"main-server-group" => {"host" => {"master" => {"master-1-server-1" => "WFLYCTL0379: System boot is in process; execution of remote management operations is not currently available"}}}}}}
我怎样才能检测到 JBoss 是真的准备好处理部署了吗?
或者,是否有一种机制可以让我在启动时自动部署某些内容?
答案1
#!/bin/bash
while true
do
wildflyStarted=$(grep -ic "Wildfly.*started in.*ms.*Started.*of.*services" /opt/wildfly/standalone/log/server.log)
if [[ "$wildflyStarted" -eq "1" ]]; then
break;
else
sleep 1;
fi
done
while true
do
ejbcaStatus=$(/opt/wildfly/bin/jboss-cli.sh -c --commands="cd deployment,cd ejbca.ear,read-attribute status")
if [[ "$ejbcaStatus" -eq "OK" ]]; then
break;
else
sleep 5;
fi
done
这个脚本对我有用。