centos7 集群整体操作脚本

 

1、在/root/bin目录创建脚本xcall.sh
2、脚本本周编写内容
[root@wd ~]# vi xcall.sh

!/bin/bash
for i in  wd1 wd2 wd3 
do
    echo -------------------$i--------------
    ssh $i "$*"    
done
3、修改脚本执行权限
[root@wd1 bin]# chmod 777 xcall.sh 
4、将/etc/profile文件追加到 ~/.bashrc(每个节点都要执行)
[root@wd1 bin]# cat /etc/profile >> ~/.bashrc
5、测试
sh xcall.sh “执行命令”
[root@wd1 bin]#sh xcall.sh ls

说明:服务器之间配置免秘钥登录

posted on 2021-03-04 15:51  uestc2007  阅读(145)  评论(0编辑  收藏  举报

导航