我需要一种从Glassfish取消部署所有应用程序的方法。通常,我会为每个应用程序使用asadmin undeploy --target=[target] [appname]"
。我的问题是我不知道服务器上存在的所有应用程序的名称。是否有一个命令允许我取消部署所有内容?感谢。
答案 0 :(得分:12)
您可以像这样创建一个bash脚本:
#!/bin/bash
ASADMIN=(path to Glassfish asadmin executable)
function undeploy_all {
for p in $*; do
echo "Undeploying $p..."
$ASADMIN undeploy $p
done;
}
apps=`$ASADMIN list-applications -t | awk '{print $1;}'`
undeploy_all $apps
运行它时,它将自动取消部署所有已部署的应用程序。它需要awk
。请务必使用ASADMIN
的路径配置asadmin
变量。
答案 1 :(得分:5)
虽然没有'undeploy everything'命令,但是有一个list-applications命令。这个page describes list-applications and some other commands将帮助您实现目标。