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)

New Contributor
Posts: 3
Registered: ‎12-14-2017

Re: Brocade SAN switch - Scripting with cfgSave

[ Edited ]

Hi,

I think starting with 7.4.1.e the option -i will ignore the confirmation prompt.
However you can use this

printf "y" | cfgsave

 

the same is for cfgenable:
printf "y" | cfgenable <config_name>

 

I chose printf insteade of echo because starting with 7.4.14, echo command is not working anymore.

 

I hope this will help you.

Broadcom Moderator
Posts: 455
Registered: ‎03-29-2011

Re: Brocade SAN switch - Scripting with cfgSave

With 7.4.1e, the cfgsave, cfgenable, and cfgDisable have added the option -f to (or --force) to bypass the confirmation requested. And also in 7.4.2, 8.0.2 and in 8.1.0. Or use printf.




If this provided you with a solution to this issue, please mark it with the button at the bottom "Accept as solution".


Any and all information provided by me is not reviewed, approved or endorsed by Brocade and is provided solely as a convenience for Brocade customers. All systems and all networks are different and unique. If you have a service affecting network problem, please open a TAC service request for service through Brocade, or through your OEM equipment provider. If this provided you with a solution to this issue, please mark it with the button at the bottom "Accept as solution"

Join the Community

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

vADC is now Pulse Secure
Download FREE NVMe eBook