【发布时间】:2016-02-11 13:33:46
【问题描述】:
我正在尝试使用期望脚本从远程服务器收集信息。出于记录目的,我正在抑制屏幕上的输出并将其重定向到本地服务器中的文件。这是我使用的脚本。这是将输出存储在本地文件中,但是日志被截断。
#!/usr/bin/expect
log_user 0
set password [lindex $argv 0]
set user [lindex $argv 1]
set host [lindex $argv 2]
set timeout -1
set file "/tmp/b"
set fp [open "/tmp/gather_info" r]
set data [read $fp]
spawn ssh $user@$host
expect "*?assword:*"
send "$password\r"
expect "*$*"
send "su - oracle\r"
expect "*oracle*"
send "$data\r"
expect {
"end_expect" exit
}
expect eof
match_max 10000
puts $file $expect_out(buffer)
我也尝试在 expect 之后使用 match_max。即使那样也帮不了我。这方面的任何建议对我都有很大的帮助。 非常感谢您回答这个问题。
【问题讨论】:
标签: output buffer expect truncated