多linux服务器之间实现文件自动复制(脚本)

多linux服务器之间实现文件自动复制(脚本)
 
#!/usr/bin/expect
set password 1234  #密码
#download
spawn scp /root/test.jar [email protected]:/usr/local/ 
set timeout 300
expect "192.168.1.2's password:"
set timeout 3000
#exec sleep 1
send "$password\r"
set timeout 300
send "exit\r"
#expect eof
interact
spawn scp /root/test.jar [email protected]:/usr/local/
set timeout 300
expect " [email protected]'s password:"
set timeout 3000
#exec sleep 1
send "$password\r"
set timeout 300
send "exit\r"
interact

你可能感兴趣的:(linux,职场,脚本,休闲)