Linux Expect Script terminates too early

expectlinux

I have an expect script that I have written that at the end calls scp to copy a large file from server A to server B.

The issue I have (which is the same using rsync and not scp) is that the expect script is terminating before the file transfer is complete. I know that I can set the timeout in expect but as the file size grows so will the timeout.

Is there anyone that has come across this issue and is there a wait function that I can use in expect?

Many thanks.

Best Answer

According to http://oreilly.com/catalog/expect/chapter/ch03.html, you can simply set timeout to -1 to disable the timeout mechanism.