Question

Until very recently I have been using the following bash script to upload any edited files to my server.

./updatesite.sh

#!/usr/bin/expect -f
spawn rsync -av -e ssh "/(...)/webs" xusernamex@xdomainx.com:/home/webs
   expect "password:"
   send "xpasswordx\r"
   expect "*\r"
   expect "\r"

Usually it has worked fine. For some reason it has abruptly stopped working several weeks ago. Here is the output it now provides:

xuserx@xdomainx.com's password: 
building file list ... done

As you can see, No files are actually uploaded. But if I paste that exact same command directly into my terminal window without the "spawn," its behavior changes and it uploads the files as usual.

Here is an example:

Squid:~ John$ rsync -av -e ssh "/(...)/webs" xuserx@xdomainx.com:/home/xuserx
xuserx@xdomainx.com's password: 
building file list ... done
webs/somefile.txt

sent 878 bytes  received 42 bytes  204.44 bytes/sec
total size is 96409  speedup is 104.79
Squid:~ John$ 

Do you know what could be causing this?

Was it helpful?

Solution

#!/usr/bin/expect -f
# exp_internal 1    ;# uncomment to turn on expect debugging
set timeout -1
spawn rsync -av -e ssh "/(...)/webs" xusernamex@xdomainx.com:/home/webs
expect "password:"
send "xpasswordx\r"
expect eof

It may be a timeout issue, so set the timeout to infinite. Since you don't have to interact with rsync in any way except for the password, just wait for it to finish (expect eof).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top