Friday, November 9, 2012

Jython Script to create Server

JYTHON SCRIPT TO CREATE SERVER

Copy the Below Code and create a file create_server.py and place the file in Deployment Manager Bin Directory  :-
#-------------------------------------------#
import sys,java
from java.util import Properties
from java.io import FileInputStream
from org.python.modules import time
lineSep = java.lang.System.getProperty('line.separator')

def server_create(node,server):
 node=AdminConfig.getid('/Node:'+node+'/')
 attr=[['name', server]]
 print "creating server .."
 AdminConfig.create('Server',node,attr)
 print "server created .."
 AdminConfig.save()
 print "saving config .."


arglen=len(sys.argv)
number_of_argument=2
if ( arglen != number_of_argument):
 print "pass 2 arguments .."
 sys.exit(-1)

server=sys.argv[0]
node=sys.argv[1]
server_create(node,server)


#----------------------------------------#









Execute the script using below wsasmin command
Windows:
Go to DMGR BIN directory

 wsadmin.bat -f create_server.py -lang jython -port -conntype SOAP -user -password  

Unix :-
Go to DMGR BIN directory


 ./wsadmin.sh -f create_server.py -lang jython -port -conntype SOAP -user -password  

Example :
 ./wsadmin.sh -f create_server.py -lang jython -port 8879 -conntype SOAP -user wasadmin -password wasadmin test_server test_node

No comments:

Post a Comment