linux中控操作相关
1、首先生成无密码登陆密钥 一般使用rsa
2、编写shell脚本
work_dir=$(pwd) ssh -p${port} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ${host_prefix}$1
3、远程拷贝
work_dir=$(pwd) for i in {2..9} do scp -P20755 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -r $1 ¥{host_prefix}$i:$2 echo done
4、远程执行命令
work_dir=$(pwd) for i in {1..9} do ssh -p20755 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ¥{host_prefix}$i "cd $work_dir; $@" done