Elinkcloud 发表于 2022-7-28 17:15:10

pssh 使用记录

1、pssh 安装
yum?-y?install?epel-releaseyum?-y?install?pssh安装完毕后有一下命令:pssh???????ssh执行命令pscp.pssh??copy到远程pslurp?????pull从远程pnuke??????kill远程进程prsync?????同步2、ssh 免密配置
?yum?-y?install?expect?ssh-keygen??-t?rsa?-f?~/.ssh/id_rsa?-N?""?-q??cat?<<?EEE??>>/tmp/sshkey.sh?for?ip?in?{192.168.56.13,192.168.56.14,192.168.56.15,192.168.56.16}doexpect?<<?EOF????????spawn?ssh-copy-id?-i?/root/.ssh/id_rsa.pub?root@$ip????????expect?{????????????????"yes/no"?{?send?"yes\n";exp_continue}????????????????"password"?{?send?"123456\n"}????????}????????expect?eofEOFdoneEEE/*那是一个描述符,告诉?shell?,管道符操作遇到这个东西就停下来。EOF?只是一个通用的称呼,其实换成别的也是可以的。这看你文件里面的具体要求。*/3、我常用的方式
3.1、远程yum 软件
?pssh?-p?4??-h?ip.txt??-i???"yum?-y?install?screen"3.2、远程kill 进程

pssh?-p?2??-h?ip.txt??-i???"sudo?pkill?-9?top"3.3、拷贝文件到远程服务器
?pscp.pssh?-h?ip.txt?ip.txt?/tmp/ip.tmp3.4、拉远程文件

#?pslurp?-h?ip.txt?/tmp/ip.tmp??/rip.txt?11:53:38??192.168.56.15?11:53:38??192.168.56.14?11:53:38??192.168.56.13?11:53:38??192.168.56.16#?ls?192.168.56.1*/192.168.56.13/:rip.txt192.168.56.14/:rip.txt192.168.56.15/:rip.txt192.168.56.16/:rip.txt#附录:
#?cat?ip.txt?192.168.56.13192.168.56.14192.168.56.15192.168.56.16#
页: [1]
查看完整版本: pssh 使用记录