Re: opcragt (cleanstart question) (513 Views)
Reply
Occasional Advisor
Bearwhale
Posts: 14
Registered: ‎01-03-2012
Message 1 of 7 (514 Views)
Accepted Solution

opcragt (cleanstart question)

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!!!

Please use plain text.
Valued Contributor
Brandy Reid
Posts: 187
Registered: ‎05-23-2005
Message 2 of 7 (513 Views)

Re: opcragt (cleanstart question)

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 :)
Please use plain text.
Occasional Advisor
Bearwhale
Posts: 14
Registered: ‎01-03-2012
Message 3 of 7 (509 Views)

Re: opcragt (cleanstart question)

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?
Please use plain text.
Occasional Advisor
SirLagz
Posts: 14
Registered: ‎11-06-2011
Message 4 of 7 (504 Views)

Re: opcragt (cleanstart question)

[ Edited ]

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
*/

  

 

Please use plain text.
Advisor
Gio-Jitsu
Posts: 19
Registered: ‎05-05-2010
Message 5 of 7 (493 Views)

Re: opcragt (cleanstart question)

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.

Please use plain text.
Occasional Advisor
Bearwhale
Posts: 14
Registered: ‎01-03-2012
Message 6 of 7 (485 Views)

Re: opcragt (cleanstart question)

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!
Please use plain text.
Valued Contributor
Brandy Reid
Posts: 187
Registered: ‎05-23-2005
Message 7 of 7 (480 Views)

Re: opcragt (cleanstart question)

Hi Bearwhale,

 

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

 

Details

 

Target

 

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 :)
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation