【问题标题】:SCP getting hangSCP 挂起
【发布时间】:2018-06-14 22:12:16
【问题描述】:

在执行以下代码时。脚本被挂起。 /var/backups/archives/ 包含大约 3 个文件,大小约为 5GB。它复制第一个文件并且脚本挂起。

spawn scp -rp user@10.10.234.1:/var/backups/archives/ /var/backup
expect "user@10.10.234.1's password:"
send "password\n"
expect eof
if [catch wait] {
    puts "failed"
    exit 1
}
exit 0

【问题讨论】:

  • expect -d /your/script.ex 看看有没有问题。

标签: linux bash unix expect scp


【解决方案1】:

我假设您在使用expect -d 运行脚本时会看到expect: timed out

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

【讨论】:

    【解决方案2】:

    谢谢,

    我在生成之前添加了 set timeout -1 并开始工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-12-31
      • 2014-05-26
      • 2013-02-19
      • 2011-11-21
      • 2012-12-20
      • 1970-01-01
      • 1970-01-01
      • 2016-01-16
      相关资源
      最近更新 更多