Fibre Channel (SAN)

Reply
N/A
Posts: 1
Registered: ‎06-20-2012

Brocade SAN switch - Scripting with cfgSave

Hi all

I'm writing a basic script to automate configuration of zones and I'm using SSH to execute the script remotely from a console.

Everything works fine until the last instruction which is:

cgfSave

In an interactive CLI window, it prompts fro entering y/n and then continue.

But I can't do it from SSH.

Is there any magic parameter like -force or -noprompt to bypass this?

Thanks!

/Dung

Valued Contributor
Posts: 931
Registered: ‎12-30-2009

Re: Brocade SAN switch - Scripting with cfgSave

The cfgsave only save the new config but doesn't make it active, to do so you need to issue a cfgenable as well.

Both commands don't have operands (cfgenable only) other than the configuration name,  not documented anyway.

To work around this you'll have to modify the script to read the output from your command and send back the needed Y.

I've seen others using expect to read and send command, but don't have hands-on experience.

According to Expect - Wikipedia, the free encyclopedia the syntax is relatively easy.

Super Contributor
Posts: 635
Registered: ‎04-12-2010

Re: Brocade SAN switch - Scripting with cfgSave

You can do it in a single line without the use of Expect. I will post this on Monday when I am back in the office.

If you have Perl knowledge you can use the Perl SSH package to run commands and react on the output in a flexible way.

The approach is similar to Expect.

Regards,

Andreas 

Contributor
Posts: 39
Registered: ‎12-08-2011

Re: Brocade SAN switch - Scripting with cfgSave

do you have an answer to this? I am looking to do the same thing. running the script from a remote ssh command hangs when i do cfgsave...

thanks

Valued Contributor
Posts: 931
Registered: ‎12-30-2009

Re: Brocade SAN switch - Scripting with cfgSave

Most probably AB refers to a "here document" within your script (or something similar)

Join the Community

Get quick and easy access to valuable resource designed to help you manage your Brocade Network.