wlst Archive

WLST Script to deploy jar file on Weblogic Server

print 'deploying jar...'

connect('weblogic','weblogic123','t3://localhost:7001')
try:

    undeploy('app')
    print 'Redeploying'

except Exception:
    print 'Deploy'

status = deploy(appName='app', path='app.jar',targets='AdminServer,', libraryModule='true')

print status

WLST Script to rotate server log file

You can use the script below to rotate server log files using WLST



connect('weblogic','weblogic123','t3://localhost:7001')
serverRuntime()
cd('LogRuntime/AdminServer')
cmo.forceLogRotation()
print 'Log file rotated'

WLST Script to start and stop Datasource

 

Script to start Datasource

connect('weblogic','weblogic123','t3://localhost:7001')
domainRuntime()
cd('ServerRuntimes/AdminServer/JDBCServiceRuntime/AdminServer/JDBCDataSourceRuntimeMBeans/PegaRULES')
objArray = jarray.array([], java.lang.Object)
strArray = jarray.array([], java.lang.String)
invoke('start', objArray, strArray)
exit()

Script to stop Datasource

connect('weblogic','weblogic123','t3://localhost:7001')
domainRuntime()
cd('ServerRuntimes/AdminServer/JDBCServiceRuntime/AdminServer/JDBCDataSourceRuntimeMBeans/PegaRULES')
objArray = jarray.array([], java.lang.Object)
strArray = jarray.array([], java.lang.String)
invoke('shutdown', objArray, strArray)
exit()