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?
#!/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).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.