LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   TCL, Expect, for Rsync - Please Help (https://www.linuxquestions.org/questions/programming-9/tcl-expect-for-rsync-please-help-137618/)

dholingw 01-22-2004 06:55 PM

TCL, Expect, for Rsync - Please Help
 
Here's something that looks, and should be as simple as it comes, but nope.. I've been at this for two days, and cannot possibly understand what is going wrong. All it is, is a TCL script, which automatically rsync's into my backup server. Here's goes:

rsync -avzrpog -e ssh /home/paradox/public_html/localserver/ paradox@69.56.7.8:/home/paradox/public_html/remoteserver/

Works cherry, but you need to manually enter the password. No good for cron jobs...

Now, let's try this automated methood:

#!/usr/bin/expect -f
spawn rsync --rsh=/usr/bin/ssh -avzrpog -e ssh /home/paradox/public_html/localserver/ paradox@69.56.7.8:/home/paradox/public_html/remoteserver/ { send "bahbahbooey\n"}
expect "Password:"

### Here's the output: ###

spawn rsync --rsh=/usr/bin/ssh -avzrpog -e ssh /home/paradox/public_html/localserver/ paradox@69.56.7.8:/home/paradox/public_html/remoteserver/ send "bahbahbooey\n"
building file list ... link_stat paradox@69.56.7.8:/home/paradox/public_html/. : No such file or directory
done
wrote 565 bytes read 20 bytes 1170.00 bytes/sec
total size is 109631 speedup is 187.40
rsync error: some files could not be transferred (code 23) at main.c(620)

Ok, it successfully logged in, but for some odd reason, it thinks the target directory dosen't exsist. I just don't get it.. How can everything go so well, and then it claims the directory does not exsist. Does anyone have a simple script like this that actually works in the way I want it to? Posting it here, or any suggestions to my above one would really be appreciated.

Dave

ToniT 02-08-2004 10:11 AM

You get one error source less if you replace the expect script with ssh-keys.

See for example the ssh howto on how to set it up. The single purpose keys are imho somewhat overkill; own paswordless key for the scripit should be fine.

dholingw 02-08-2004 10:27 AM

Why, thank you Sir :)

I finally figured that out, and it works great!

Appreciate the response,

Dave


All times are GMT -5. The time now is 08:57 PM.