预计脚本运行不同步?
我目前正在修改用于备份 cisco ACE 模块上下文和内容的脚本。加密文件。它在一台设备上工作得非常完美。但是,当我在另一个模块上使用它时,它似乎完全不同步并且弄乱了脚本。
据我所知,差异在于 ACE 模块抛出的一行的存在,如下所示:警告:将“[xxxx]”(RSA)永久添加到已知主机列表中。\r\r \n
这似乎把脚本的其余部分扔掉了,尽管我的期望语句都没有在寻找这个!
我对expect 以及它解释来自ace 模块的信息的方式都做过噩梦;任何人都可以阐明这个问题,或者提供有关当我尝试为这些设备编写脚本时如何使这些设备正常运行的任何建议吗?
I'm currently modifying a script used to backup cisco ACE modules' contexts & crypto files. it works absolutely beautifully with one device. however, when i use it on another module, it seems to go completely out of sync and it messes up the script.
From what I can see, the differences are in the presence of a line that the ACE module throws up as so: Warning: Permanently added '[x.x.x.x]' (RSA) to the list of known hosts.\r\r\n
this just seems to throw the rest of the script off, even though none of my expect statements are even looking for this!
I've had nothing but nightmares with expect and the way in which it interprets information from ace modules; can anyone shed any light on this issue or provide any advice as to how to make these devices behave when I try to script for them?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您一次处理一个连接,则应确保在打开下一个连接之前完全终止一个连接。最简单的方法是将:
在 (
foreach
) 循环的末尾放置要连接的事物。如果您同时进行多个连接,则必须小心地对各种命令使用
-i
选项(特别是expect
、send
> 和close
)并使一切正常工作此外修复我之前提到的问题。它可以完成,但是如果您不需要并行性,那么它会更加棘手并且不值得。If you're handling one connection at a time, you should make sure you fully terminate one before opening the next. The simplest way of doing that is to put:
At the end of the (
foreach
) loop over the things to connect to.If you were doing multiple connections at once, you'd have to take care to use the
-i
option to various commands (notablyexpect
,send
andclose
) and make everything work right in addition to fixing the things I mentioned earlier. It can be done, but it's considerably more tricky and not worth it if you don't need the parallelism.