javascriptbatch-fileweblogicwlst

weblogic undeploy apps command line


I have a requirement where i need to undeploy war files in weblogic using command line, the below code does it for me :

 java weblogic.Deployer -adminurl t3://localhost:8001 -user weblogic -password password123  -name <name> -undeploy 

But the file names change after every deployment, i,e (file 1.0.0 and file 1.1.1).

i need a command in such a way so that it undeploys all the files present in that server.

can any body let me know how to undeploy all files at a single go ?

Thanks in advance,

Vishal


Solution

  • I have found out how to undeploy all the apps :

    List Apps:
    
    
    import sys
    connect('weblogic','weblogic10','http://autowfm-vmh:7259')
    cd("AppDeployments")
    app = ls(returnMap='true')
    domainRuntime()
    cd("AppRuntimeStateRuntime/AppRuntimeStateRuntime")
    
    i=1
    f = open('filename.txt','w')
    for appName in app:
    
    print >>f, appName
    
    i=i+1
    f.close()
    exit()
    
    Undeploy :
    
    import os
    connect('weblogic','weblogic','http://localhost:7001')
    target='AdminServer' 
    f = open(r'D:\filename.txt','r') 
    print f 
    
    for i in range(10): 
    line=f.readline() 
    line1=line[:-1] 
    appName='./'+line1 
    print '*****************'+appName 
    
    undeploy(appName=line1)
    exit()