SCP陷入困境

问题描述 投票:-1回答:2

执行以下代码时。脚本被绞死了。 / var / backups / archives /包含大约3个大小约为5GB的文件。它复制第一个文件和脚本挂起。

spawn scp -rp [email protected]:/var/backups/archives/ /var/backup
expect "[email protected]'s password:"
send "password\n"
expect eof
if [catch wait] {
    puts "failed"
    exit 1
}
exit 0
linux bash unix expect scp
2个回答
1
投票

我假设当你用expect: timed out运行你的脚本时你会看到expect -d

set timeout 60之后将send "password\n"插入新行。将60替换为大于所有文件的传输时间(以秒为单位)的数字。


1
投票

谢谢,

我在spawn之前添加了set timeout -1并且它开始工作了。

© www.soinside.com 2019 - 2024. All rights reserved.