imthekrish Respected Contributor.
Respected Contributor.
662 views

Running script on servers parallelly

Jump to solution

Hello All,

here is my table 

APP_ID   ENV    HOSTNAME    Component        order

XY        TEST        Server1               A1                    1                  

XY        TEST       Server2               A2                   2

XY        TEST       Server3               C1                    1

XY        TEST       Server4               C2                    2

XY        TEST      Server5              PE1                     1

XY        TEST      Server6             PE2                     2

XY        TEST      Server7              PE3                    3

XY        TEST       Server8             PE4                   4

XY        TEST       Server9              CS1                   1        

XY         TEST    Server10           CS2                      2

 

I have to run a script on servers whoes order is 1, "parallely" and next time i should run same script on servers whoes order is 2 "parallely and repeat this until highest order. Highest order may vary from application to application.

set 1 will have servers of order 1 and the script should run parallely on these servers.

set 2 will have servers of order 2 and the script should run parallely on these servers.

so on.. until the highest order which may vary from application to app. How do I develop this flow.

Here is what i tried I used TNS Names SQL operation to query the DB, List Appeneder to append that data and at no more items i used the parallel operation. I cannot get the right query and also how do i make those sets with list of servers. 

ONLY after finishing set 1, it should look for set2.

All the different ways i thought didnt work for me. Please suggest a good way to do this. Script basically stop services running on that server. and start it later. 

Labels (1)
0 Likes
1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

Re: Running script on servers parallelly

Jump to solution

Hi, 

Since you did not mention the version of OO I will assume that you will be using oo 10.x.

 

First step is to gather the data from your DB using a simple select script (something like select hostname from $your_table_here where order = 1), then filter out the result so it resembles a char separated list (replace new lines with a unique identifier). Once you have the list of servers  feed it to a multi-instance step as a multi value input with the unique identifier as delimiter and then run your script from the inside of the multi instance step. Once you are done with the first order redo all steps and so on.  See attached screenshot for details on multi instance details. (the steps in the flow have been renamed to highlight what they should do).

 

Hope This Helps,

Vlad

4 Replies
Micro Focus Expert
Micro Focus Expert

Re: Running script on servers parallelly

Jump to solution

Hi, 

Since you did not mention the version of OO I will assume that you will be using oo 10.x.

 

First step is to gather the data from your DB using a simple select script (something like select hostname from $your_table_here where order = 1), then filter out the result so it resembles a char separated list (replace new lines with a unique identifier). Once you have the list of servers  feed it to a multi-instance step as a multi value input with the unique identifier as delimiter and then run your script from the inside of the multi instance step. Once you are done with the first order redo all steps and so on.  See attached screenshot for details on multi instance details. (the steps in the flow have been renamed to highlight what they should do).

 

Hope This Helps,

Vlad

imthekrish Respected Contributor.
Respected Contributor.

Re: Running script on servers parallelly

Jump to solution

Thank you so much for the response, I got this idea but here i'm hitiing database highest order of times. what I was looking for is, hit the DB once and get all the servers whose order is 1 as a set1 and  order 2 as set 2 and so on up to the highest order. and feed multiinstance set by set. Can we do that in HPOO.

Thanks again, that attachment is a great help!!

0 Likes
imthekrish Respected Contributor.
Respected Contributor.

Re: Running script on servers parallelly

Jump to solution

Hello VladM,

can i get path of that "Run Script" operation. Does this operation work for Windows/Linux/Unix servers. In my case the servers may be different and the path of the script also may be different on each server. I'm thinking to store the path for each server and highest order for that application in DB.

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: Running script on servers parallelly

Jump to solution

Hi,

As i said in my post the names of the operations in the flow were changed to ilustrate what the part of the flow should be doing.

Now that being said in the Base content pack under the operations folder we have the Remote Command Execution folder under which we have SSH command operation which by using the SSH server can run commands/scripts against most unix/linux distributions out there (can be run from both a windows and an unix/linux worker)  and if openssh is installed on windows hosts it can run some commands/scripts against windows hosts.

For windows hosts we can use the operation/flow Remote Command Execution  (same content pack as above) over WMI protocol (usually for remote hosts), using local protocol (strictly for localhost) or if available globalshell/telnet. When using RCE operation/flow with WMI it must always be run from a windows worker.

For more advanced windows scripts we have in the Basecontent pack under the Operations/PowerShell folder the option to run powershell commands/scripts. Do note that some settings on the environments have to be performed to enable powershell commands/scripts to work. Check the description of the powershell folder to see what are the requirements in order to use powershell scripts. 

To address your other concer you are correct you can get all the servers and their order in one single db querry and then through filters/scriptlets or simple logic in oo create  multiple lists of servers which you could then feed to multi instance steps.

Regards,

Vlad

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.