Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Is there any script that is handy

Posted on 2009-02-18
7
Medium Priority
?
550 Views
Last Modified: 2013-12-10
We used to spend a lot of time ending in deploying and stopping/restarting the managed servers ( if required) from admin console . will appreciate , if there is any script that will do the above things...
might the script will take the args say ..

installOrDepoly.sh      BEA_HOME ADMIN_SERVER_HOST ADMIN_SERVER_PORT ADMIN_SERVER_USERNAME ADMIN_SERVER_PASSWORD
0
Comment
Question by:sukh45
  • 5
6 Comments
 
LVL 10

Expert Comment

by:rajesh_bala
ID: 23679350
Well, if you need scripts only for deploying and redeploying your applications you can check out the WLST scripts.

These are jython scripts which can be used for controlling admin related activities.

I am pasting some of them for deploying and redeploying.

#Deploy.py
#=========
 
#=======================================================================================
# This is an example of a WLST online configuration script. This example demonstrates
# how to deploy an application. 
#
# Please note that many values used in this script are subject to change based 
# on your WebLogic installation and the template you are using.
#
# Usage: 
#	wlst deploy.py <Admin server host:port> <path to app> <target> <DeploymentName>
#=======================================================================================
 
#=======================================================================================
# Connect to the Admin Server, where the host and port is supplied as an argument
#=======================================================================================
connect('weblogic','weblogic',sys.argv[1])
 
#=======================================================================================
# deploy the application. The appname is hard-coded. The path to the app and the target
# server/cluster are supplied as arguments
#=======================================================================================
deploy(appName=sys.argv[4],path=sys.argv[2],targets=sys.argv[3])
 
#=======================================================================================
# The website you'll want to use to access the app 
#=======================================================================================
 
#java.lang.Runtime.getRuntime().exec("explorer " + sys.argv[4])
 
#====================================================================================
# Exit WLST.
#=======================================================================================
exit()

Open in new window

0
 
LVL 10

Expert Comment

by:rajesh_bala
ID: 23679354

#redeploy.py
 
#=======================================================================================
# This is an example of a WLST online configuration script. This example demonstrates
# how to redeploy an application. 
#
# Please note that many values used in this script are subject to change based 
# on your WebLogic installation and the template you are using.
#
# Usage: 
#      wlst <Admin server host:port> <URL to invoke>
#
# Where: 
#      <WLST_script> specifies the full path to the WLST script.
#=======================================================================================
 
 
#=======================================================================================
# Connect to the Admin Server, where the host and port is supplied as an argument
#=======================================================================================
connect('weblogic','weblogic',sys.argv[1])
 
#=======================================================================================
# redeploy the application. The appname is hard-coded. 
#=======================================================================================
redeploy(sys.argv[2])
 
#=======================================================================================
# The website you'll want to use to access the app 
#=======================================================================================
#java.lang.Runtime.getRuntime().exec("explorer " + sys.argv[2])
#=======================================================================================
# Exit WLST.
#=======================================================================================
exit()

Open in new window

0
 
LVL 10

Expert Comment

by:rajesh_bala
ID: 23679359
You can run setDomainEnv.sh from command prompt. Then it automatically sets the environment variables etc required for running WLST.

Once you are done with that, you can just run the above commands mentioned in the code snippets (see the usage in the code snippet) to deploy and redeploy.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:sukh45
ID: 23679603
Thanks Rajesh .... I dont want to perform any admin related activities ((complex) .... Please share any simple script (like the ones before) for starting / stopping managed servers....
0
 
LVL 10

Accepted Solution

by:
rajesh_bala earned 500 total points
ID: 23679634

#startCluster.py
#=======================================================================================
# This is an example of a WLST configuration script. This example demonstrates
# how to start a single-cluster domain.
#
# Please note that many values used in this script are subject to change based
# on your WebLogic installation and the template you are using.
#
# Usage:
#      wlst startcluster.py <admin server host:port> <domain name> <cluster name>
#
#=======================================================================================
# set the following values if your installation is different
bea_home='c:\wls9'
weblogic_home='c:\\wls9\\weblogic90'
 
# nmhome and domaindir are based on the above settings
nmhome = weblogic_home + '\\common\\nodemanager'
domaindir = bea_home + '\\user_projects\\domains\\' + sys.argv[2]
 
# Start the node manager process
startNodeManager(verbose='true', NodeManagerHome=nmhome)
 
#Connect to the node manager
nmConnect(domainName='myclusterdomain',domainDir=domaindir)
 
# Start the Admin Server
nmStart('AdminServer')
 
# Connect to the Admin Server
connect('weblogic','weblogic', sys.argv[1])
 
# Start the cluster comprising of ms1 and ms2
start(sys.argv[3],'Cluster')
 
exit()

Open in new window

0
 
LVL 10

Expert Comment

by:rajesh_bala
ID: 23679636

#StopCluster.py
#=======================================================================================
# This is an example of a WLST online configuration script. This example demonstrates
# how to stop a server. 
#
# Please note that many values used in this script are subject to change based 
# on your WebLogic installation and the template you are using.
#
# Usage: 
#      wlst stopcluster.py <domain name> 
#
#=======================================================================================
# set the following values if your installation is different
bea_home='c:\wls9'
weblogic_home='c:\\wls9\\weblogic90'
 
# nmhome and domaindir are based on the above settings
nmhome = weblogic_home + '\\common\\nodemanager'
domaindir = bea_home + '\\user_projects\\domains\\' + sys.argv[1]
 
#Connect to the node manager
nmConnect(domainName='myclusterdomain',domainDir=domaindir)
 
 
# Stop the specified server
nmKill('ms1')
nmKill('ms2')
nmKill('AdminServer')
 
 
exit()

Open in new window

0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This Windows batch file is useful for organizing image files from a digital camera or other source, but can have many other uses.  It simply renames the file(s) to match their create date.  For example, if you took a picture today at 1:40pm and the …
This article is about some of the basic and important steps to be used to improve the performance in web-sphere commerce application development. 1) Always leverage the Dyna-caching facility provided by the product 2) Remove the unwanted code …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question