Undeploy all applications from Glassfish

狂风中的少年 提交于 2019-12-01 04:12:43

问题


I need a way to undeploy all my applications from Glassfish. Normally, I would use asadmin undeploy --target=[target] [appname]" for each application. My problem is that I don't know the name of all applications that are present on the server. Is there a command that would allow me to just undeploy everything? Thanks.


回答1:


While there isn't an 'undeploy everything' command, there is a list-applications command. This page describes list-applications and some other commands that will help you achieve your goal.




回答2:


You can create a bash script like this one:

#!/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

When you run it, it will undeploy all deployed applications automatically. It needs awk. Make sure to configure the ASADMIN variable with the path to asadmin.



来源:https://stackoverflow.com/questions/17346811/undeploy-all-applications-from-glassfish

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!