简体   繁体   English

在Expect脚本中进行rsync

[英]rsync in Expect script

     #!/usr/bin/expect -f
        #set timeout 25
        spawn rsync root@14.12.123.82:'/usr/backups /usr/backup-scripts /root/test/' /root/
        expect "root@14.12.123.82's password: $"
        #send "\$xxxxxx\n"
        #expect "\\$ $

What is wrong with the above script i get an error saying invalid rsync options 上面的脚本有什么问题我收到错误消息,指出无效的rsync选项

From man rsync , this is the new syntax for multiple files: man rsync出发,这是多个文件的新语法:

rsync -av host:file1 :file2 host:file{3,4} /dest/

The old syntax you are using should still work in the command line, but try this in spawn : 您使用的旧语法仍应在命令行中运行,但请在spawn尝试以下操作:

spawn rsync root@14.12.123.82:/usr/backups :/usr/backup-scripts :/root/test/ /root/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM