标签:scp
有这样一个要求,有N台服务器,每台服务器的端口都不一样
比如 1.1.1.1:22;
2.2.2.2:33;
3.3.3.3:55;
……
所有服务器都做成免密登录
首先写一个文件把ip和对应的端口写入 比如: vim scp.log 1.1.1.1:22 2.2.2.2:33 3.3.3.3:55 …… vim scp.sh #!/bin/bash #author:limingyu (Email:348450594@qq.com) #this is a scp.sh while read line do for i in $line do touch /tmp/scp.txt echo $i > /tmp/scp.txt scp /tmp/a.txt -P `awk -F: ‘{print $NF}‘ /tmp/scp.txt` root@`awk -F: ‘{print $1}‘ /tmp/sc p.txt`:/tmp/ echo > /tmp/scp.txt done done < /tmp/scp.log
标签:scp
原文地址:http://limingyu.blog.51cto.com/12564998/1904777