我有一个简单的“健全性检查”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
这个脚本对我有用。