UPDATE! The community will be go into read-only on April 19, 8am Pacific in preparation for migration on April 21. Read more.
UPDATE! The community will be go into read-only on April 19, 8am Pacific in preparation for migration on April 21.Read more.
Absent Member.. Absent Member..
Absent Member..
1415 views

opcragt (cleanstart question)

Jump to solution

Hey folks. Not sure if this is the right sub-forum, but I've been wondering whether there's a way to run the "cleanstart" command on multiple nodes in one command. Is there a way to create a list of nodes and run the "cleanstart" (or even "status") commands on that list?

 

Instead of typing something like:

 

opcragt -cleanstart node_name1

 

*Wait for command to finish*

 

opcragt -cleanstart node_name2

 

*Wait for command to finish*

 

opcragt -cleanstart node_name2

 

And so on...

 

is there a way to type a command like:

 

opcragt -cleanstart node_name1,node_name2,node_name3

 

To run cleanstarts on multiple nodes at once? Or even to run through a list of nodes and attempt to cleanstart them one by one?

 

If this is a silly question, I apologize. I'm a little new at this. I suppose I could try creating a batch file to do this but I'm not sure where I'd go with that either.

 

Thanks!!!

Labels (1)
0 Likes
1 Solution

Accepted Solutions
Absent Member.. Absent Member..
Absent Member..

A really simple way to run commands to a batch of nodes is creating a text file with the list of nodes you want to process (one node name per line) and then running a one-liner using the "for" command on your Operating System command line:

 

For Windows:

 

FOR /F %variable in (FILE) DO command

 

example>

 

for /f %i in (node_list.txt) do opcragt -cleanstart %i

 

For Unix:

 

(as you type each line you'll get a secondary prompt allowing you type the next line in the script):

 

for i in `cat node_list.txt`

do

opcragt -cleanstart $i

done

 

Notice the backquotes on the `cat ....`

 

Hope this helps.

View solution in original post

6 Replies
Absent Member.. Absent Member..
Absent Member..

Hi Bearwhale,

 

Have you tried creating a tool to run the command?  This way you could run it on many nodes at one time.

 

http://www.linkedin.com/in/brandyreid
Say "Thanks" by clicking on Kudo's to the left 🙂
Absent Member.. Absent Member..
Absent Member..
Hey Brandy!

No, I haven't tried creating a tool. I guess that's my next step.

Do you know where I could find information about where to start with that?
0 Likes
Absent Member.. Absent Member..
Absent Member..

Here's a quick JScript one that I've whipped up, haven't tested it though.

Chuck the below code into a file, name it something.js

then run it like this

cscript something.js node1 node2

 

Edited the code slightly

 

/*
Begin
*/
var wsh = new ActiveXObject("wscript.shell")

if(WScript.Arguments.length > 0) {
    intArgLength = WScript.Arguments.length
    for(args = 0; args < intArgLength; args++) {
        wsh.run("opcragt -cleanstart "+WScript.Arguments.Item(args))
    }
}
/*
End
*/

  

 

Absent Member.. Absent Member..
Absent Member..

A really simple way to run commands to a batch of nodes is creating a text file with the list of nodes you want to process (one node name per line) and then running a one-liner using the "for" command on your Operating System command line:

 

For Windows:

 

FOR /F %variable in (FILE) DO command

 

example>

 

for /f %i in (node_list.txt) do opcragt -cleanstart %i

 

For Unix:

 

(as you type each line you'll get a secondary prompt allowing you type the next line in the script):

 

for i in `cat node_list.txt`

do

opcragt -cleanstart $i

done

 

Notice the backquotes on the `cat ....`

 

Hope this helps.

View solution in original post

Absent Member.. Absent Member..
Absent Member..
Thanks, everyone!!!

This gives me something to work with. I think I'll be able to make other batch commands off what you've given me.

Kudos all around!
0 Likes
Absent Member.. Absent Member..
Absent Member..

Hi Bearwhale,

 

I created the tool and tested it and it works correctly.

 

 

 

This is from the system.txt after the tool was executed

 

0: INF: Wed Jan 04 09:46:32 2012: coda (3212/2344): Stopping CODA

0: INF: Wed Jan 04 09:49:03 2012: ovconfd (2212/2208): (conf-393) Configuration and Deploy process 'ovconfd' stopped.

0: INF: Wed Jan 04 09:49:04 2012: ovbbccb (2724/2720): (bbc-250) OV Communication Broker stopped. Exit code (0).

 

0: INF: Wed Jan 04 09:49:21 2012: ovconfd (5552/58556): (conf-390) Configuration and Deploy process 'ovconfd' started.

0: INF: Wed Jan 04 09:49:22 2012: coda (2496/54012): Waiting to initialize SCOPE ...

0: INF: Wed Jan 04 09:49:29 2012: coda (2496/54012): SCOPE datasource initialization succeeded

 

Hope this helps 🙂

http://www.linkedin.com/in/brandyreid
Say "Thanks" by clicking on Kudo's to the left 🙂
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.