Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要在一些远程 Solaris/Linux 服务器上运行一些命令,并将它们的输出收集到本地服务器上的日志文件中。
目前,我正在使用一个简单的 Expect 脚本,驻留在本地服务器上以触发目标系统上的命令。然后我将期望脚本的输出重定向到一个日志文件,如下所示,
/usr/local/bin/expect script.exp >> logfile.txt
然而,事实证明这是非常不可靠的,因为与服务器的连接波动很大,导致日志不完整和脚本挂起。
有没有更好、更可靠的方法来完成这项任务?
我已经实施了 fedorqui 的回答,
到目前为止,该解决方案一直运行良好,没有出现故障。