0

I have a basic scp sending mechanism with spawn, expect and send.

However it gets aborted during the scp transmission.

Here is the expect command:

expect -c "spawn sh -c {scp -r -P 22 /tmp/rootfs/* root@IP:/.}
expect {
password: {send \"pw12\r\"; exp_continue }
}
exit"

This gets interrupted during the scp transmission.

However if I try like this:

scp -r -P 22 /tmp/rootfs/* root@IP:/.

It will ask for the password, then I type it in, and all the files gets uploaded.

I could not dig deeper yet, what could be the problem?

1

1 Answer 1

1

As @Kamil comments, consider the timeout -- how long does it take to transfer those files?

Also, expect to see the end of the spawned process:

expect {
    password: {send \"pw12\r\"; exp_continue }
    eof
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .