06-20-2012 03:29 PM
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:
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?
06-20-2012 10:23 PM
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.
06-21-2012 10:55 PM
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.