rsync之expect脚本shell

 

r_expect.sh

#!/bin/expect -f

set timeout 30

#spawn rsync -avz --delete --exclude-from=exclude.list -e "ssh -i /home/user/.ssh/key" user@192.168.1.20:/home/htdocs/www.abc.com /home/backup/code/
spawn /bin/rsync -avz --delete --exclude-from=/log/microchat/rsync/rsync_exclude /log/microchat/ lottery@103.30.4.144:/www/log/im/

#expect "Enter passphrase for key '/home/user/.ssh/key':"
expect "103.30.4.14's password:"

send "lottery2018\r"

#interact

set timeout 60
expect eof
exit

 

上一篇:du命令如何过滤隐藏文件


下一篇:Git 的两种忽略文件方式 gitignore 和 exclude