分發系統:自動同步文件腳本
[[email protected] ~]# cat 4.expect
#!/usr/bin/expect set passwd "123456" spawn rsync -av /tmp/1.txt root@192.168.11.18:/tmp/ # 要求兩端都安裝 rsync expect { "yes/no" { send "yes\r" } "password:" { send "$passwd\r" } } expect eof
[[email protected] ~]# chmod a+x 4.expect [[email protected]
分發系統:自動同步文件腳本