Solved Create a script that will provide input and extract output

October 31, 2014 at 01:12:07
Specs: Solaris
Hi Experts,

Good day.

I would like to seek your assistance in creating a script that will provide an input and extract output from the 'MMControl start CLI` utility.

Upon the execution of the utility 'MMControl start CLI` , the following will be input:

10.192.152.137:8080
mmsuper
mediation

upon the display of the following texts:

Manager
User
Password

Once the prompt 'multimediation>' appeared, a command 'laa' will be executed that will extract the alarms and be displayed on the screen.

When displayed to the screen, the expectation is that user will be exxited from the 'multimediation>' prompt via exit command.

Is it possible for it to be achived without installing a package similar to 'expect' in Linux.

----------------------------------------------------
EMMPDP01:~# MMControl start CLI
Manager : 10.192.152.137:8080
User : mmsuper
Password : mediation
Connect to http://10.192.152.137:8080/CXC17347...
StartConnection...
multimediation>
multimediation> laa
----------------------------------------------------

Thanks and Best Regards,
Jefrey


See More: Create a script that will provide input and extract output

Report •

#1
October 31, 2014 at 06:28:29
It all depends upon how the MMControl program is written. If it is written as interactive command like the unix passwd command, then you are force4 to use expect or some other scripting language. This link describes how to obtain and use expect:

http://www.computing.net/answers/un...

And it's my stupid, wild guess that you'll have to use expect.

However, if the command is non interactive, place your commands into a file and redirect that to the command. So, anywhere input is required place a line in a text file such as input.txt:

10.192.152.137:8080
mmsuper
mediation
laa
exit

# UNTESTED: Input is redirected from input.txt. I will be surprised if this works
'MMControl start CLI < input.txt


MMControl start CLI

message edited by nails


Report •

#2
October 31, 2014 at 07:36:48
HI Nails,

Thank you for this. The system is solaris. Is it possible to intall the expect package or is there a similar tool in Solaris?

Thank you for your prompt assistance.

Thanks and Best Regards,
Jefrey


Report •

#3
October 31, 2014 at 08:45:24
✔ Best Answer
I am not aware of a similar tool for Solaris. Expect is in the public domain so anyone can use it free.

Expect does not come bundled with Solaris as part of the normal install package and I don't have experience installing Expect. (I do know that Expect runs on top of tcl, so tcl must also be installeed.)

As I stated, the Expect home page is:

http://www.nist.gov/el/msid/expect.cfm

It also appears to be available at http://www.sunfreeware.com

Google "Expect" & "Solaris" and you'' get a ton of links that should help.


Report •
Related Solutions


Ask Question