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.
12-14-2017 05:36 AM - edited 12-14-2017 05:37 AM
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.
12-14-2017 06:21 AM
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.