【发布时间】:2019-08-20 09:46:17
【问题描述】:
我有一些使用jboss-cli -c --controller=... --file=myscript.cli 运行的脚本。
-c 和 --controller 选项很棒,因为我的脚本不知道它应该在哪个服务器上运行并且可以重复用于多个服务器。
我现在想使用offline-cli 功能来避免端口冲突,并防止在设置服务器时通过网络访问服务器。
我现在的问题是,为了启动嵌入式服务器,我必须使用 CLI 命令embed-server,但我不想将该命令添加到我的脚本中,因为脚本不应该知道服务器配置 xml 文件。
很遗憾,我不能同时使用 --command="embed-server --server-config=my-standalone.xml" 和 --file=myscript.cli,因为 CLI 会抱怨:
Only one of '--file', '--commands' or '--command' can appear as the argument at a time.
我尝试的另一件事是:--commands="embed-server --server-config=my-standalone.xml,run-batch --file=\"myscript.cli\" 但这也不起作用,因为我的脚本包含一些 if-else 逻辑,例如:
if (outcome == success) of /subsystem=iiop-openjdk:read-resource()
/subsystem=iiop-openjdk:remove()
end-if
不幸的是,批处理模式不支持条件逻辑(请参阅https://bugzilla.redhat.com/show_bug.cgi?id=1083176)。
【问题讨论】: