Avatar of prathapjava
prathapjava
Flag for United States of America asked on

WAS7 automation scripts

like that i have 20 apps
so now i am running each application using below command at command prompt manually:
wsadmin.bat -lang jython -f C:/opt/WAS/xxxx/deployments/scripts/createJ2Cauth.py C:/opt/WAS/xxxx/deployments/scripts/apps/yyyy/app1/createj2cauth.properties
............
in my development environment it is working fine
Now my questions is:
1) i need a shell script or jython script to run and set all resources(like batch file) on UNIX and windows environment
2) i need a shell script or jython script to run particular .py and .properties to set resource by taking the user input.
Ex: i need to update only J2C authentications
i am not expert in shell or jython script could you please somebody help me on this ...

Thanks in advance
Scripting Languages

Avatar of undefined
Last Comment
HonorGod

8/22/2022 - Mon
HonorGod

You have lots of options.
For example:
- if all of the commands to be executed are in some directory, and they all use the same properties file, you could have a Jython script expect / require the "directory" containing the scripts to be executed.  It could then use operating systems command to identify all of the *.py (or *.jy) files in the specified directory, and use "execfile" command to execute each.
> The challenges:
  ? What should be done if & when an error is encountered?

- Another possibility: have a file contain the list of script to be executed.
  This has the advantage of specifying an order in which the scripts should be run.

What would you like to do?
prathapjava

ASKER
we have 20 applications  folder structure like below:
each application i created below WAS scripts to configures resources in WAS7:
C:\opt\WAS\xxxxx\deployments\scripts\createdatasource.py
C:\opt\WAS\xxxxx\deployments\scripts\deployear.py
C:\opt\WAS\xxxxx\deployments\scripts\createtimermanager.py
C:\opt\WAS\xxxxx\deployments\scripts\createJ2CAuth.py
C:\opt\WAS\xxxxx\deployments\scripts\createworkmanager.py

each application properties we have separate properties file directories like below
app1:
C:\opt\WAS\xxxxx\deployments\scripts\apps\yyyy\app1\createdatasource.properties
C:\opt\WAS\xxxxx\deployments\scripts\apps\yyyy\app1\deployear.propetties
C:\opt\WAS\xxxxx\deployments\scripts\apps\yyyy\app1\createtimermanager.properties
C:\opt\WAS\xxxxx\deployments\scripts\apps\yyyys\app1\createJ2CAuth.properties
C:\opt\WAS\xxxxx\deployments\scripts\apps\yyyy\app1\createworkmanager.properties
app2:
................................................
............................................
..................................................
like that i have 20 apps
so now i am running each application using below command at command prompt manually:
wsadmin.bat -lang jython -f C:/opt/WAS/xxxx/deployments/scripts/createJ2Cauth.py C:/opt/WAS/xxxx/deployments/scripts/apps/yyyy/app1/createj2cauth.properties
............
in my development environment it is working fine
Now my questions is:
1) i need a shell script or jython script to run and set all resources(like batch file) on UNIX and windows environment
2) i need a shell script or jython script to run particular .py and .properties to set resource by taking the user input.
Ex: i need to update only J2C authentications
i am not expert in shell or jython script could you please somebody help me on this ...

Thanks in advance
HonorGod

Much of which just said was stated when you opened the question.

Q: Do each of the scripts to configures resources, i.e., the ones in this folder:

     C:\opt\WAS\xxxxx\deployments\scripts

     each contain a single (or small number) of function definitions?
     or, do the each contain a bunch of code?

Can you attach one, or a small number, so that we can get an idea what they look like?
If you can, please include the corresponding properties file so that we can better understand how the scripts work.

Would you prefer 1 script that allows you to specify command line options identifying the operation to be performed?

For example, something like:

wsadmin -lang jython -f configure.py --application AppName --operation createJ2Cauth

Open in new window


If the directories containing the function to be executed, and the properties files are fixed, then this could be "hard coded" in the "configure.py" script.

Does that make sense?

Of course this is just one, of many possible, options.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
prathapjava

ASKER
As you mentioned please find the attached createJ2C.py and create j2c.properties files

now i am running particular .py file using the command below in windows command prompt its working fine:
wsadmin.bat -lang jython -f C:/opt/WAS/xxxxx/deployments/scripts/createJ2Cauth.py C:\opt\WAS\xxxxx\deployments\scripts\apps\yyyys\app1\createJ2CAuth.properties

here j2c for one application app1 is working fine but i have app1,app2,app3...........app20 like 20applicatication i need shell or jython script to run all apps at a time and also i need another script in that user can input app name command line  arguments like
app3 j2c update/create then the script should able to call particular .py and respective .properties file this is my requirement

sorry for the confusion i think now you got my question

thanks in advance
createJ2CAuth.py
createj2cauth.txt
ASKER CERTIFIED SOLUTION
HonorGod

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
prathapjava

ASKER
Thanks sir its working fine
HonorGod

Thanks for the grade & points.

Good luck & have a great day.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.