Undeploy all applications from Glassfish

后端 未结 2 1943
忘掉有多难
忘掉有多难 2021-01-13 08:10

I need a way to undeploy all my applications from Glassfish. Normally, I would use asadmin undeploy --target=[target] [appname]\" for each application. My probl

2条回答
  •  一个人的身影
    2021-01-13 08:46

    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.

提交回复
热议问题