expect无信任远程批量拷贝文件
来源:互联网 发布:edge网络是什么 编辑:程序博客网 时间:2024/05/19 16:33
#!/bin/bash
# Remote Copy file
# date 20160821
username=root
passwd=123456
usage(){
echo "Usage:sh `basename $0` -f [hostlist] Local_file Remote_file"
exit 1
}
while getopts ":f:" optname
do
case "$optname" in
f|-f)
file=$OPTARG
;;
*)
usage
;;
esac
done
shift $(($OPTIND-1))
src_file="$1"
# Remote Copy file
# date 20160821
username=root
passwd=123456
usage(){
echo "Usage:sh `basename $0` -f [hostlist] Local_file Remote_file"
exit 1
}
while getopts ":f:" optname
do
case "$optname" in
f|-f)
file=$OPTARG
;;
*)
usage
;;
esac
done
shift $(($OPTIND-1))
src_file="$1"
dest_file="$2"
if [ -z $src_file ] || [ -z $dest_file ] ;then
usage
fi
if [ ! -f $file ] ;then
echo "Host file $file does not exist"
exit
fi
for ip in `cat $file`
do
/usr/bin/expect<<EOF
set timeout 10
spawn scp -r $src_file $username@$ip:$dest_file
expect {
"*yes/no" { send "yes\r"; exp_continue}
"*password:" { send "$passwd\r" }
}
expect "100%"
expect eof
EOF
done
0 0
- expect无信任远程批量拷贝文件
- expect无信任远程批量执行命令
- Linux使用expect实现远程拷贝文件
- expect一键批量拷贝
- 自动远程拷贝expect脚本
- scp远程拷贝expect实现SHELL
- expect安装及远程scp拷贝
- linux下scp远程拷贝文件无需输入密码工具之expect
- linux批量修改密码、拷贝文件至远程机器
- Linux 批量拷贝数据脚本 + ssh 无密码登陆远程LINUX主机
- 如何批量拷贝文件
- 批处理拷贝远程文件
- linux 拷贝远程文件
- 远程拷贝文件
- scp远程拷贝文件
- 远程拷贝文件 scp
- VPS 远程拷贝文件
- scp远程拷贝文件
- ZONE.js
- 搞清楚 Python traceback
- base64编码学习笔记(一)
- 关于最近工作的一些想法
- 记录
- expect无信任远程批量拷贝文件
- 如何在SpringMVC 的@Controller 层中获取bean
- java注解详解
- ubuntu14.04.1 LTS 64bits较快的更新源
- JAVA注解的实际应用--生成sql语句
- TCP 偶尔出现connection refused
- js中 this 的指向
- Jvm原理剖析与调优之内存结构
- Atitit 遍历文件夹算法 autoit attilax总结