预计脚本运行不同步?

发布于 2024-12-10 09:18:11 字数 310 浏览 0 评论 0原文

我目前正在修改用于备份 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

美男兮 2024-12-17 09:18:11

如果您一次处理一个连接,则应确保在打开下一个连接之前完全终止一个连接。最简单的方法是将:

close
wait

在 (foreach) 循环的末尾放置要连接的事物。


如果您同时进行多个连接,则必须小心地对各种命令使用 -i 选项(特别是 expectsend > 和 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:

close
wait

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 (notably expect, send and close) 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文